Fix hass stop in bootstrap (#132795)

This commit is contained in:
Artur Pragacz 2025-03-11 02:29:26 +01:00 committed by GitHub
parent 37213503b1
commit 2e79db3695
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -299,14 +299,6 @@ async def async_setup_hass(
return hass
async def stop_hass(hass: core.HomeAssistant) -> None:
"""Stop hass."""
# Ask integrations to shut down. It's messy but we can't
# do a clean stop without knowing what is broken
with contextlib.suppress(TimeoutError):
async with hass.timeout.async_timeout(10):
await hass.async_stop()
hass = await create_hass()
if runtime_config.skip_pip or runtime_config.skip_pip_packages:
@ -345,7 +337,7 @@ async def async_setup_hass(
if config_dict is None:
recovery_mode = True
await stop_hass(hass)
await hass.async_stop(force=True)
hass = await create_hass()
elif not basic_setup_success:
@ -353,7 +345,7 @@ async def async_setup_hass(
"Unable to set up core integrations. Activating recovery mode"
)
recovery_mode = True
await stop_hass(hass)
await hass.async_stop(force=True)
hass = await create_hass()
elif any(
@ -368,7 +360,7 @@ async def async_setup_hass(
old_logging = hass.data.get(DATA_LOGGING)
recovery_mode = True
await stop_hass(hass)
await hass.async_stop(force=True)
hass = await create_hass()
if old_logging: