From 20afa1544bbb9b5f2e04b1f84127c3cb1f0ee794 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 00:22:12 +0200 Subject: [PATCH 1/6] Bump version to 105 --- hassio/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hassio/const.py b/hassio/const.py index d2985e48b..df1885582 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -2,7 +2,7 @@ from pathlib import Path from ipaddress import ip_network -HASSIO_VERSION = '104' +HASSIO_VERSION = '105' URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/' 'hassio/{}/version.json') From f361916a60af73109a8042f4cd96f98555af3a13 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 17:37:20 +0200 Subject: [PATCH 2/6] Update docker timeout to 900sec (#486) --- hassio/docker/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hassio/docker/__init__.py b/hassio/docker/__init__.py index e91da35f4..aaf633473 100644 --- a/hassio/docker/__init__.py +++ b/hassio/docker/__init__.py @@ -24,7 +24,7 @@ class DockerAPI: """Initialize docker base wrapper.""" self.docker = docker.DockerClient( base_url="unix:/{}".format(str(SOCKET_DOCKER)), - version='auto', timeout=300) + version='auto', timeout=900) self.network = DockerNetwork(self.docker) @property From 124e487ef7036683718d970561b67e9978230d59 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 17:53:09 +0200 Subject: [PATCH 3/6] Support new panel generation (#487) * Support new panel generation * fix lint --- hassio/api/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hassio/api/__init__.py b/hassio/api/__init__.py index 90c8758a8..f139dbaf6 100644 --- a/hassio/api/__init__.py +++ b/hassio/api/__init__.py @@ -202,8 +202,14 @@ class RestAPI(CoreSysAttributes): web.get('/panel_latest', create_response('hassio-main-latest')), ]) - # This route is for HA > 0.61 - self.webapp.add_routes([web.static('/app-es5', panel_dir)]) + # This route is for backwards compatibility with HA 0.62 - 0.70 + self.webapp.add_routes([ + web.get('/app-es5/index.html', create_response('index')), + web.get('/app-es5/hassio-app.html', create_response('hassio-app')), + ]) + + # This route is for HA > 0.70 + self.webapp.add_routes([web.static('/app', panel_dir)]) async def start(self): """Run rest api webserver.""" From fe155a4ff0e678c6779e87c9f10c6b9d818fa649 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 19:14:09 +0200 Subject: [PATCH 4/6] Read version from AWS (#488) * Read version from AWS * Update const.py * Update updater.py * Update updater.py * Update updater.py * Update updater.py * Update updater.py * Update const.py * Update updater.py --- hassio/const.py | 7 +++---- hassio/updater.py | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/hassio/const.py b/hassio/const.py index df1885582..3498b28d5 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -4,10 +4,9 @@ from ipaddress import ip_network HASSIO_VERSION = '105' -URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/' - 'hassio/{}/version.json') - -URL_HASSIO_ADDONS = 'https://github.com/home-assistant/hassio-addons' +URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" +URL_HASSIO_VERSION = \ + "https://s3.amazonaws.com/hassio-version/{channel}.json" HASSIO_DATA = Path("/data") diff --git a/hassio/updater.py b/hassio/updater.py index 14ac30328..fbe22af12 100644 --- a/hassio/updater.py +++ b/hassio/updater.py @@ -1,15 +1,15 @@ """Fetch last versions from webserver.""" import asyncio +from contextlib import suppress from datetime import timedelta import json import logging import aiohttp -import async_timeout from .const import ( URL_HASSIO_VERSION, FILE_HASSIO_UPDATER, ATTR_HOMEASSISTANT, ATTR_HASSIO, - ATTR_CHANNEL, CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV) + ATTR_CHANNEL) from .coresys import CoreSysAttributes from .utils import AsyncThrottle from .utils.json import JsonConfig @@ -17,12 +17,6 @@ from .validate import SCHEMA_UPDATER_CONFIG _LOGGER = logging.getLogger(__name__) -CHANNEL_TO_BRANCH = { - CHANNEL_STABLE: 'master', - CHANNEL_BETA: 'rc', - CHANNEL_DEV: 'dev', -} - class Updater(JsonConfig, CoreSysAttributes): """Fetch last versions from version.json.""" @@ -65,12 +59,11 @@ class Updater(JsonConfig, CoreSysAttributes): Is a coroutine. """ - url = URL_HASSIO_VERSION.format(CHANNEL_TO_BRANCH[self.channel]) + url = URL_HASSIO_VERSION.format(channel=self.channel) try: _LOGGER.info("Fetch update data from %s", url) - with async_timeout.timeout(10): - async with self.sys_websession.get(url) as request: - data = await request.json(content_type=None) + async with self.sys_websession.get(url, timeout=10) as request: + data = await request.json(content_type=None) except (aiohttp.ClientError, asyncio.TimeoutError, KeyError) as err: _LOGGER.warning("Can't fetch versions from %s: %s", url, err) @@ -81,11 +74,18 @@ class Updater(JsonConfig, CoreSysAttributes): return # data valid? - if not data: + if not data or data.get(ATTR_CHANNEL) != self.channel: _LOGGER.warning("Invalid data from %s", url) return - # update versions - self._data[ATTR_HOMEASSISTANT] = data.get('homeassistant') - self._data[ATTR_HASSIO] = data.get('hassio') + # update supervisor versions + with suppress(KeyError): + self._data[ATTR_HASSIO] = data['supervisor'] + + # update Home Assistant version + machine = self.sys_machine or 'default' + with suppress(KeyError): + self._data[ATTR_HOMEASSISTANT] = \ + data['homeassistant'][machine] + self.save_data() From 33794669a14efef17f33b6c4f957d425ecbf8a43 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 19:36:01 +0200 Subject: [PATCH 5/6] Last version.json update --- version.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/version.json b/version.json index 22ad0ccb5..ac2d4f9fb 100644 --- a/version.json +++ b/version.json @@ -1,8 +1,4 @@ { - "hassio": "104", - "homeassistant": "0.70.0", - "resinos": "1.3", - "resinhup": "0.3", - "generic": "0.3", - "cluster": "0.1" + "hassio": "105", + "homeassistant": "0.70.0" } From 41943ba61acf102073c4fb9db2402f312952dd4c Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 29 May 2018 19:38:00 +0200 Subject: [PATCH 6/6] Delete .gitattributes --- .gitattributes | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 8dcdc753a..000000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore version on merge -version.json merge=ours