Remove config check over supervisor (#22156)
* Remove config check over supervisor * Fix lint * Fix tests
This commit is contained in:
1 parent
e5a2ef9b8d
commit
ecfe0fc3dd
4 files changed
+19
-70
No files matched your search
@@ -7,6 +7,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.auth.const import GROUP_ID_ADMIN
|
||||
from homeassistant.components import SERVICE_CHECK_CONFIG
|
||||
import homeassistant.config as conf_util
|
||||
from homeassistant.const import (
|
||||
ATTR_NAME, SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP)
|
||||
from homeassistant.core import DOMAIN as HASS_DOMAIN, callback
|
||||
@@ -130,23 +131,6 @@ def is_hassio(hass):
|
||||
return DOMAIN in hass.config.components
|
||||
|
||||
|
||||
@bind_hass
|
||||
async def async_check_config(hass):
|
||||
"""Check configuration over Hass.io API."""
|
||||
hassio = hass.data[DOMAIN]
|
||||
|
||||
try:
|
||||
result = await hassio.check_homeassistant_config()
|
||||
except HassioAPIError as err:
|
||||
_LOGGER.error("Error on Hass.io API: %s", err)
|
||||
raise HomeAssistantError() from None
|
||||
else:
|
||||
if result['result'] == "error":
|
||||
return result['message']
|
||||
|
||||
return None
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up the Hass.io component."""
|
||||
# Check local setup
|
||||
@@ -259,9 +243,13 @@ async def async_setup(hass, config):
|
||||
await hassio.stop_homeassistant()
|
||||
return
|
||||
|
||||
error = await async_check_config(hass)
|
||||
if error:
|
||||
_LOGGER.error(error)
|
||||
try:
|
||||
errors = await conf_util.async_check_ha_config_file(hass)
|
||||
except HomeAssistantError:
|
||||
return
|
||||
|
||||
if errors:
|
||||
_LOGGER.error(errors)
|
||||
hass.components.persistent_notification.async_create(
|
||||
"Config error. See dev-info panel for details.",
|
||||
"Config validating", "{0}.check_config".format(HASS_DOMAIN))
|
||||
|
||||
@@ -97,13 +97,6 @@ class HassIO:
|
||||
"""
|
||||
return self.send_command("/homeassistant/stop")
|
||||
|
||||
def check_homeassistant_config(self):
|
||||
"""Check Home-Assistant config with Hass.io API.
|
||||
|
||||
This method return a coroutine.
|
||||
"""
|
||||
return self.send_command("/homeassistant/check", timeout=600)
|
||||
|
||||
@_api_data
|
||||
def retrieve_discovery_messages(self):
|
||||
"""Return all discovery data from Hass.io API.
|
||||
|
||||
Reference in new issue
Block a user