mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 03:26:32 +00:00
Fix version conflict
This commit is contained in:
commit
9084ac119f
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,2 +0,0 @@
|
||||
# Ignore version on merge
|
||||
version.json merge=ours
|
@ -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."""
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,11 +59,10 @@ 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:
|
||||
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:
|
||||
@ -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()
|
||||
|
@ -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"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user