mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 02:56:31 +00:00
Addon api changes (#2006)
* Add startup to addon info API * Don't fail when validating, just return the problem as 200 * Add sugestions * Review comments
This commit is contained in:
parent
02872b5e75
commit
e64cf41aec
3
API.md
3
API.md
@ -491,7 +491,7 @@ Update information for a single interface
|
||||
| Option | Description |
|
||||
| --------- | ---------------------------------------------------------------------- |
|
||||
| `address` | The new IP address for the interface in the X.X.X.X/XX format |
|
||||
| `dns` | List of DNS servers to use |
|
||||
| `dns` | List of DNS servers to use |
|
||||
| `gateway` | The gateway the interface should use |
|
||||
| `method` | Set if the interface should use DHCP or not, can be `dhcp` or `static` |
|
||||
|
||||
@ -565,6 +565,7 @@ Get all available add-ons.
|
||||
"version": "null|VERSION_INSTALLED",
|
||||
"version_latest": "version_latest",
|
||||
"state": "none|started|stopped",
|
||||
"startup": "initialize|system|services|application|once",
|
||||
"boot": "auto|manual",
|
||||
"build": "bool",
|
||||
"options": "{}",
|
||||
|
@ -62,6 +62,7 @@ from ..const import (
|
||||
ATTR_MEMORY_LIMIT,
|
||||
ATTR_MEMORY_PERCENT,
|
||||
ATTR_MEMORY_USAGE,
|
||||
ATTR_MESSAGE,
|
||||
ATTR_NAME,
|
||||
ATTR_NETWORK,
|
||||
ATTR_NETWORK_DESCRIPTION,
|
||||
@ -78,11 +79,13 @@ from ..const import (
|
||||
ATTR_SLUG,
|
||||
ATTR_SOURCE,
|
||||
ATTR_STAGE,
|
||||
ATTR_STARTUP,
|
||||
ATTR_STATE,
|
||||
ATTR_STDIN,
|
||||
ATTR_UDEV,
|
||||
ATTR_URL,
|
||||
ATTR_USB,
|
||||
ATTR_VALID,
|
||||
ATTR_VERSION,
|
||||
ATTR_VERSION_LATEST,
|
||||
ATTR_VIDEO,
|
||||
@ -250,6 +253,7 @@ class APIAddons(CoreSysAttributes):
|
||||
ATTR_AUDIO: addon.with_audio,
|
||||
ATTR_AUDIO_INPUT: None,
|
||||
ATTR_AUDIO_OUTPUT: None,
|
||||
ATTR_STARTUP: addon.startup,
|
||||
ATTR_SERVICES: _pretty_services(addon),
|
||||
ATTR_DISCOVERY: addon.discovery,
|
||||
ATTR_IP_ADDRESS: None,
|
||||
@ -320,10 +324,14 @@ class APIAddons(CoreSysAttributes):
|
||||
async def options_validate(self, request: web.Request) -> None:
|
||||
"""Validate user options for add-on."""
|
||||
addon = self._extract_addon_installed(request)
|
||||
data = {ATTR_MESSAGE: "", ATTR_VALID: True}
|
||||
try:
|
||||
addon.schema(addon.options)
|
||||
except vol.Invalid as ex:
|
||||
raise APIError(humanize_error(addon.options, ex)) from None
|
||||
data[ATTR_MESSAGE] = humanize_error(addon.options, ex)
|
||||
data[ATTR_VALID] = False
|
||||
|
||||
return data
|
||||
|
||||
@api_process
|
||||
async def security(self, request: web.Request) -> None:
|
||||
|
@ -195,6 +195,7 @@ ATTR_MAP = "map"
|
||||
ATTR_MEMORY_LIMIT = "memory_limit"
|
||||
ATTR_MEMORY_PERCENT = "memory_percent"
|
||||
ATTR_MEMORY_USAGE = "memory_usage"
|
||||
ATTR_MESSAGE = "message"
|
||||
ATTR_METHOD = "method"
|
||||
ATTR_METHODS = ["dhcp", "static"]
|
||||
ATTR_MODE = "mode"
|
||||
@ -262,6 +263,7 @@ ATTR_USB = "usb"
|
||||
ATTR_USER = "user"
|
||||
ATTR_USERNAME = "username"
|
||||
ATTR_UUID = "uuid"
|
||||
ATTR_VALID = "valid"
|
||||
ATTR_VALUE = "value"
|
||||
ATTR_VERSION = "version"
|
||||
ATTR_VERSION_LATEST = "version_latest"
|
||||
|
Loading…
x
Reference in New Issue
Block a user