mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-21 08:06:30 +00:00
Fix corrupt container on startup (#2122)
This commit is contained in:
parent
3f6453aa89
commit
8da686fc34
@ -18,6 +18,7 @@ from .coresys import CoreSys, CoreSysAttributes
|
||||
from .exceptions import (
|
||||
DockerError,
|
||||
HassioError,
|
||||
HomeAssistantCrashError,
|
||||
HomeAssistantError,
|
||||
SupervisorUpdateError,
|
||||
)
|
||||
@ -241,8 +242,16 @@ class Core(CoreSysAttributes):
|
||||
self.sys_homeassistant.boot
|
||||
and not await self.sys_homeassistant.core.is_running()
|
||||
):
|
||||
with suppress(HomeAssistantError):
|
||||
try:
|
||||
await self.sys_homeassistant.core.start()
|
||||
except HomeAssistantCrashError as err:
|
||||
_LOGGER.warning("Can't start Home Assistant Core - rebuild")
|
||||
self.sys_capture_exception(err)
|
||||
|
||||
with suppress(HomeAssistantError):
|
||||
await self.sys_homeassistant.core.rebuild()
|
||||
except HomeAssistantError as err:
|
||||
self.sys_capture_exception(err)
|
||||
else:
|
||||
_LOGGER.info("Skip start of Home Assistant")
|
||||
|
||||
|
@ -20,6 +20,10 @@ class HomeAssistantUpdateError(HomeAssistantError):
|
||||
"""Error on update of a Home Assistant."""
|
||||
|
||||
|
||||
class HomeAssistantCrashError(HomeAssistantError):
|
||||
"""Error on crash of a Home Assistant startup."""
|
||||
|
||||
|
||||
class HomeAssistantAPIError(HomeAssistantError):
|
||||
"""Home Assistant API exception."""
|
||||
|
||||
|
@ -15,7 +15,12 @@ from packaging import version as pkg_version
|
||||
from ..coresys import CoreSys, CoreSysAttributes
|
||||
from ..docker.homeassistant import DockerHomeAssistant
|
||||
from ..docker.stats import DockerStats
|
||||
from ..exceptions import DockerError, HomeAssistantError, HomeAssistantUpdateError
|
||||
from ..exceptions import (
|
||||
DockerError,
|
||||
HomeAssistantCrashError,
|
||||
HomeAssistantError,
|
||||
HomeAssistantUpdateError,
|
||||
)
|
||||
from ..utils import convert_to_ascii, process_lock
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
@ -392,7 +397,7 @@ class HomeAssistantCore(CoreSysAttributes):
|
||||
break
|
||||
|
||||
self._error_state = True
|
||||
raise HomeAssistantError()
|
||||
raise HomeAssistantCrashError()
|
||||
|
||||
async def repair(self):
|
||||
"""Repair local Home Assistant data."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user