Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |

Expand Down Expand Up @@ -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": "{}",
Expand Down
10 changes: 9 additions & 1 deletion supervisor/api/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
ATTR_MEMORY_LIMIT,
ATTR_MEMORY_PERCENT,
ATTR_MEMORY_USAGE,
ATTR_MESSAGE,
ATTR_NAME,
ATTR_NETWORK,
ATTR_NETWORK_DESCRIPTION,
Expand All @@ -78,11 +79,13 @@
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,
Expand Down Expand Up @@ -250,6 +253,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
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,
Expand Down Expand Up @@ -320,10 +324,14 @@ async def options(self, request: web.Request) -> None:
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:
Expand Down
2 changes: 2 additions & 0 deletions supervisor/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
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"
Expand Down Expand Up @@ -262,6 +263,7 @@
ATTR_USER = "user"
ATTR_USERNAME = "username"
ATTR_UUID = "uuid"
ATTR_VALID = "valid"
ATTR_VALUE = "value"
ATTR_VERSION = "version"
ATTR_VERSION_LATEST = "version_latest"
Expand Down