mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-10-16 07:09:30 +00:00
Add options validation
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from .util import api_process, json_loads
|
||||
import voluptuous as vol
|
||||
|
||||
from .util import api_process, api_validate
|
||||
from ..const import ATTR_VERSION, ATTR_CURRENT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SCHEMA_VERSION = vol.Schema({
|
||||
vol.Optional(ATTR_VERSION): vol.Coerce(str),
|
||||
})
|
||||
|
||||
|
||||
class APIHomeAssistant(object):
|
||||
"""Handle rest api for homeassistant functions."""
|
||||
@@ -30,7 +36,7 @@ class APIHomeAssistant(object):
|
||||
@api_process
|
||||
async def update(self, request):
|
||||
"""Update host OS."""
|
||||
body = await request.json(loads=json_loads)
|
||||
body = await api_validate(SCHEMA_VERSION, request)
|
||||
version = body.get(ATTR_VERSION, self.config.current_homeassistant)
|
||||
|
||||
if self.dock_hass.in_progress:
|
||||
|
Reference in New Issue
Block a user