From 0ed48a7741bb245559abe99e0126a4b10ad376c2 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 29 Jun 2017 07:50:42 +0200 Subject: [PATCH] fix self update style on startup (#85) * fix self update style on startup * Check beta/dev upstream on update function --- hassio/core.py | 10 +++++----- hassio/tasks.py | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hassio/core.py b/hassio/core.py index 93f820b3e..488966b66 100644 --- a/hassio/core.py +++ b/hassio/core.py @@ -1,4 +1,5 @@ """Main file for HassIO.""" +import asyncio import logging import aiohttp @@ -113,11 +114,10 @@ class HassIO(object): """Start HassIO orchestration.""" # on release channel, try update itself # on beta channel, only read new versions - if not self.config.upstream_beta: - await self.loop.create_task( - hassio_update(self.config, self.supervisor, self.websession)()) - else: - await self.config.fetch_update_infos(self.websession) + await asyncio.wait( + [hassio_update(self.config, self.supervisor, self.websession)()], + loop=self.loop + ) # start api await self.api.start() diff --git a/hassio/tasks.py b/hassio/tasks.py index 824a5dc1c..65d04a140 100644 --- a/hassio/tasks.py +++ b/hassio/tasks.py @@ -26,6 +26,11 @@ def hassio_update(config, supervisor, websession): if config.last_hassio == supervisor.version: return + # don't perform a update on beta/dev channel + if config.upstream_beta: + _LOGGER.warning("Ignore Hass.IO update on beta upstream!") + return + _LOGGER.info("Found new HassIO version %s.", config.last_hassio) await supervisor.update(config.last_hassio)