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 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.""" diff --git a/hassio/const.py b/hassio/const.py index d2985e48b..3498b28d5 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -2,12 +2,11 @@ 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') - -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/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 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() diff --git a/version.json b/version.json index 3f9e82e57..ac2d4f9fb 100644 --- a/version.json +++ b/version.json @@ -1,8 +1,4 @@ { - "hassio": "103.3", - "homeassistant": "0.70.0", - "resinos": "1.3", - "resinhup": "0.3", - "generic": "0.3", - "cluster": "0.1" + "hassio": "105", + "homeassistant": "0.70.0" }