Allow missing components in safe mode (#102888)

pull/102894/head
Erik Montnemery 2023-10-27 12:25:27 +02:00 committed by GitHub
parent 43915fbaf3
commit 294f565bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -127,7 +127,7 @@ async def async_check_ha_config_file( # noqa: C901
try:
integration = await async_get_integration_with_requirements(hass, domain)
except loader.IntegrationNotFound as ex:
if not hass.config.recovery_mode:
if not hass.config.recovery_mode and not hass.config.safe_mode:
result.add_error(f"Integration error: {domain} - {ex}")
continue
except RequirementsNotFound as ex:

View File

@ -125,6 +125,19 @@ async def test_component_not_found_recovery_mode(hass: HomeAssistant) -> None:
assert not res.errors
async def test_component_not_found_safe_mode(hass: HomeAssistant) -> None:
"""Test no errors if component not found in safe mode."""
# Make sure they don't exist
files = {YAML_CONFIG_FILE: BASE_CONFIG + "beer:"}
hass.config.safe_mode = True
with patch("os.path.isfile", return_value=True), patch_yaml_files(files):
res = await async_check_ha_config_file(hass)
log_ha_config(res)
assert res.keys() == {"homeassistant"}
assert not res.errors
async def test_component_platform_not_found_2(hass: HomeAssistant) -> None:
"""Test errors if component or platform not found."""
# Make sure they don't exist