mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 21:26:29 +00:00
Improve supervisor update handling (#300)
* Improve supervisor update handling * fix message position
This commit is contained in:
parent
0c44064926
commit
f8e6362283
@ -54,8 +54,9 @@ class HassIO(CoreSysAttributes):
|
||||
"""Start HassIO orchestration."""
|
||||
# on release channel, try update itself
|
||||
# on beta channel, only read new versions
|
||||
if not self._updater.beta_channel:
|
||||
await self._supervisor.update()
|
||||
if not self._updater.beta_channel and self._supervisor.need_update:
|
||||
if await self._supervisor.update():
|
||||
return
|
||||
else:
|
||||
_LOGGER.info("Ignore Hass.io auto updates on beta mode")
|
||||
|
||||
@ -93,7 +94,7 @@ class HassIO(CoreSysAttributes):
|
||||
if self._homeassistant.version == 'landingpage':
|
||||
self._loop.create_task(self._homeassistant.install())
|
||||
|
||||
_LOGGER.info("Hass.io is up and running")
|
||||
_LOGGER.info("Hass.io is up and running")
|
||||
|
||||
async def stop(self):
|
||||
"""Stop a running orchestration."""
|
||||
|
@ -21,6 +21,11 @@ class Supervisor(CoreSysAttributes):
|
||||
_LOGGER.fatal("Can't setup supervisor docker container!")
|
||||
await self.instance.cleanup()
|
||||
|
||||
@property
|
||||
def need_update(self):
|
||||
"""Return True if a update is available."""
|
||||
return self.version != self.last_version
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""Return version of running homeassistant."""
|
||||
|
@ -32,7 +32,6 @@ class Tasks(CoreSysAttributes):
|
||||
|
||||
async def load(self):
|
||||
"""Add Tasks to scheduler."""
|
||||
|
||||
self.jobs.add(self._scheduler.register_task(
|
||||
self._update_addons, self.RUN_UPDATE_ADDONS))
|
||||
self.jobs.add(self._scheduler.register_task(
|
||||
@ -54,6 +53,8 @@ class Tasks(CoreSysAttributes):
|
||||
self._watchdog_homeassistant_api,
|
||||
self.RUN_WATCHDOG_HOMEASSISTANT_API))
|
||||
|
||||
_LOGGER.info("All core tasks are scheduled")
|
||||
|
||||
async def _cleanup_sessions(self):
|
||||
"""Cleanup old api sessions."""
|
||||
now = datetime.now()
|
||||
@ -83,8 +84,7 @@ class Tasks(CoreSysAttributes):
|
||||
|
||||
async def _update_supervisor(self):
|
||||
"""Check and run update of supervisor hassio."""
|
||||
await self._updater.reload()
|
||||
if self._supervisor.last_version == self._supervisor.version:
|
||||
if not self._supervisor.need_update:
|
||||
return
|
||||
|
||||
# don't perform a update on beta/dev channel
|
||||
|
Loading…
x
Reference in New Issue
Block a user