Only check frontend for safe mode if frontend wanted to be loa… (#31969)
* Only check frontend for safe mode if frontend wanted to be loaded * Update test
This commit is contained in:
parent
8255bdf3d5
commit
4e765398cc
2 changed files with 7 additions and 3 deletions
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
||||||
REQUIRED_NEXT_PYTHON_VER,
|
REQUIRED_NEXT_PYTHON_VER,
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import DATA_SETUP, async_setup_component
|
||||||
from homeassistant.util.logging import AsyncHandler
|
from homeassistant.util.logging import AsyncHandler
|
||||||
from homeassistant.util.package import async_get_user_site, is_virtual_env
|
from homeassistant.util.package import async_get_user_site, is_virtual_env
|
||||||
from homeassistant.util.yaml import clear_secret_cache
|
from homeassistant.util.yaml import clear_secret_cache
|
||||||
|
@ -102,7 +102,10 @@ async def async_setup_hass(
|
||||||
_LOGGER.warning("Unable to set up core integrations. Activating safe mode")
|
_LOGGER.warning("Unable to set up core integrations. Activating safe mode")
|
||||||
safe_mode = True
|
safe_mode = True
|
||||||
|
|
||||||
elif "frontend" not in hass.config.components:
|
elif (
|
||||||
|
"frontend" in hass.data.get(DATA_SETUP, {})
|
||||||
|
and "frontend" not in hass.config.components
|
||||||
|
):
|
||||||
_LOGGER.warning("Detected that frontend did not load. Activating safe mode")
|
_LOGGER.warning("Detected that frontend did not load. Activating safe mode")
|
||||||
# Ask integrations to shut down. It's messy but we can't
|
# Ask integrations to shut down. It's messy but we can't
|
||||||
# do a clean stop without knowing what is broken
|
# do a clean stop without knowing what is broken
|
||||||
|
|
|
@ -400,7 +400,8 @@ async def test_setup_safe_mode_if_no_frontend(
|
||||||
log_no_color = Mock()
|
log_no_color = Mock()
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.config.async_hass_config_yaml", return_value={"browser": {}}
|
"homeassistant.config.async_hass_config_yaml",
|
||||||
|
return_value={"map": {}, "person": {"invalid": True}},
|
||||||
):
|
):
|
||||||
hass = await bootstrap.async_setup_hass(
|
hass = await bootstrap.async_setup_hass(
|
||||||
config_dir=get_test_config_dir(),
|
config_dir=get_test_config_dir(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue