1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Fix write options handling (#84)

* Fix write options handling

* Fix bug
This commit is contained in:
Pascal Vizeli
2017-06-28 23:06:06 +02:00
committed by GitHub
parent d5eb66bc0d
commit 56a9f64730
3 changed files with 15 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import asyncio
import logging
import voluptuous as vol
from voluptuous.humanize import humanize_error
from .util import api_process, api_process_raw, api_validate
from ..const import (
@@ -92,13 +93,20 @@ class APIAddons(object):
async def uninstall(self, request):
"""Uninstall addon."""
addon = self._extract_addon(request)
return await asyncio.shield(addon.uninstall(), loop=self.loop)
@api_process
async def start(self, request):
"""Start addon."""
addon = self._extract_addon(request)
# check options
options = addon.options
try:
addon.schema(options)
except vol.Invalid as ex:
raise RuntimeError(humanize_error(options, ex)) from None
return await asyncio.shield(addon.start(), loop=self.loop)
@api_process