Merge pull request #585 from home-assistant/dev

Release 117
This commit is contained in:
Pascal Vizeli 2018-07-21 20:21:18 +02:00 committed by GitHub
commit f2bf8dea93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 30 deletions

View File

@ -2,7 +2,7 @@
from pathlib import Path from pathlib import Path
from ipaddress import ip_network from ipaddress import ip_network
HASSIO_VERSION = '116' HASSIO_VERSION = '117'
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
URL_HASSIO_VERSION = \ URL_HASSIO_VERSION = \

View File

@ -6,8 +6,7 @@ import logging
from .coresys import CoreSysAttributes from .coresys import CoreSysAttributes
from .const import ( from .const import (
STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE) STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE)
from .exceptions import HassioError from .exceptions import HassioError, HomeAssistantError
from .utils.dt import fetch_timezone
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -21,11 +20,6 @@ class HassIO(CoreSysAttributes):
async def setup(self): async def setup(self):
"""Setup HassIO orchestration.""" """Setup HassIO orchestration."""
# update timezone
if self.sys_config.timezone == 'UTC':
self.sys_config.timezone = \
await fetch_timezone(self.sys_websession)
# Load Supervisor # Load Supervisor
await self.sys_supervisor.load() await self.sys_supervisor.load()
@ -93,6 +87,7 @@ class HassIO(CoreSysAttributes):
# run HomeAssistant # run HomeAssistant
if self.sys_homeassistant.boot: if self.sys_homeassistant.boot:
with suppress(HomeAssistantError):
await self.sys_homeassistant.start() await self.sys_homeassistant.start()
# start addon mark as application # start addon mark as application

View File

@ -1,4 +1,5 @@
"""HassOS support on supervisor.""" """HassOS support on supervisor."""
import asyncio
import logging import logging
from pathlib import Path from pathlib import Path
@ -92,7 +93,7 @@ class HassOS(CoreSysAttributes):
_LOGGER.info("OTA update is downloaded on %s", raucb) _LOGGER.info("OTA update is downloaded on %s", raucb)
return raucb return raucb
except aiohttp.ClientError as err: except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch versions from %s: %s", url, err) _LOGGER.warning("Can't fetch versions from %s: %s", url, err)
except OSError as err: except OSError as err:

View File

@ -393,7 +393,7 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
headers[hdrs.AUTHORIZATION] = f'Bearer {self.access_token}' headers[hdrs.AUTHORIZATION] = f'Bearer {self.access_token}'
async with getattr(self.sys_websession_ssl, method)( async with getattr(self.sys_websession_ssl, method)(
url, timeout=timeout, json=json url, timeout=timeout, json=json, headers=headers
) as resp: ) as resp:
# Access token expired # Access token expired
if resp.status == 401 and self.refresh_token: if resp.status == 401 and self.refresh_token:

View File

@ -1,4 +1,5 @@
"""HomeAssistant control object.""" """HomeAssistant control object."""
import asyncio
import logging import logging
from pathlib import Path from pathlib import Path
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
@ -60,7 +61,7 @@ class Supervisor(CoreSysAttributes):
async with self.sys_websession.get(url, timeout=10) as request: async with self.sys_websession.get(url, timeout=10) as request:
data = await request.text() data = await request.text()
except aiohttp.ClientError as err: except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch AppArmor profile: %s", err) _LOGGER.warning("Can't fetch AppArmor profile: %s", err)
return return

View File

@ -1,4 +1,5 @@
"""Fetch last versions from webserver.""" """Fetch last versions from webserver."""
import asyncio
from contextlib import suppress from contextlib import suppress
from datetime import timedelta from datetime import timedelta
import json import json
@ -81,7 +82,7 @@ class Updater(JsonConfig, CoreSysAttributes):
async with self.sys_websession.get(url, timeout=10) as request: async with self.sys_websession.get(url, timeout=10) as request:
data = await request.json(content_type=None) data = await request.json(content_type=None)
except aiohttp.ClientError as err: except (aiohttp.ClientError, asyncio.TimeoutError) as err:
_LOGGER.warning("Can't fetch versions from %s: %s", url, err) _LOGGER.warning("Can't fetch versions from %s: %s", url, err)
raise HassioUpdaterError() from None raise HassioUpdaterError() from None

View File

@ -3,7 +3,6 @@ from datetime import datetime, timedelta, timezone
import logging import logging
import re import re
import aiohttp
import pytz import pytz
UTC = pytz.utc UTC = pytz.utc
@ -23,22 +22,6 @@ DATETIME_RE = re.compile(
) )
async def fetch_timezone(websession):
"""Read timezone from freegeoip."""
data = {}
try:
async with websession.get(FREEGEOIP_URL, timeout=10) as request:
data = await request.json()
except aiohttp.ClientError as err:
_LOGGER.warning("Can't fetch freegeoip data: %s", err)
except ValueError as err:
_LOGGER.warning("Error on parse freegeoip data: %s", err)
return data.get('time_zone', 'UTC')
# Copyright (c) Django Software Foundation and individual contributors. # Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved. # All rights reserved.
# https://github.com/django/django/blob/master/LICENSE # https://github.com/django/django/blob/master/LICENSE