Skip to content

Commit

Permalink
Remove unhealthy after failed update on startup (#5412)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdegat01 authored Nov 14, 2024
1 parent 687d765 commit a8e7bb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions supervisor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,12 @@ async def start(self):

# On release channel, try update itself if auto update enabled
if self.sys_supervisor.need_update and self.sys_updater.auto_update:
try:
if not self.healthy:
_LOGGER.warning("Ignoring Supervisor updates!")
else:
if not self.healthy:
_LOGGER.warning("Ignoring Supervisor updates!")
else:
with suppress(SupervisorUpdateError):
await self.sys_supervisor.update()
return
except SupervisorUpdateError as err:
_LOGGER.critical(
"Can't update Supervisor! This will break some Add-ons or affect "
"future versions of Home Assistant!"
)
self.sys_resolution.unhealthy = UnhealthyReason.SUPERVISOR
capture_exception(err)

# Start addon mark as initialize
await self.sys_addons.boot(AddonStartup.INITIALIZE)
Expand Down
2 changes: 1 addition & 1 deletion supervisor/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async def update(self, version: AwesomeVersion | None = None) -> None:
)
capture_exception(err)
raise SupervisorUpdateError(
f"Update of Supervisor failed: {err!s}", _LOGGER.error
f"Update of Supervisor failed: {err!s}", _LOGGER.critical
) from err

self.sys_config.version = version
Expand Down

0 comments on commit a8e7bb6

Please sign in to comment.