mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-07 17:26:32 +00:00
Fix timeout on freegeoip (#581)
* Fix timeout on freegeoip * Update updater.py * Update supervisor.py * Update dt.py * Update hassos.py * Update core.py * Update hassos.py * Update supervisor.py * Update updater.py
This commit is contained in:
parent
57c58d81c0
commit
f51c9704e0
@ -25,6 +25,7 @@ class HassIO(CoreSysAttributes):
|
||||
if self.sys_config.timezone == 'UTC':
|
||||
self.sys_config.timezone = \
|
||||
await fetch_timezone(self.sys_websession)
|
||||
self.sys_loop.call_soon(self.sys_config.save_data)
|
||||
|
||||
# Load Supervisor
|
||||
await self.sys_supervisor.load()
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""HassOS support on supervisor."""
|
||||
import asyncio
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
@ -92,7 +93,7 @@ class HassOS(CoreSysAttributes):
|
||||
_LOGGER.info("OTA update is downloaded on %s", 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)
|
||||
|
||||
except OSError as err:
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""HomeAssistant control object."""
|
||||
import asyncio
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
@ -60,7 +61,7 @@ class Supervisor(CoreSysAttributes):
|
||||
async with self.sys_websession.get(url, timeout=10) as request:
|
||||
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)
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Fetch last versions from webserver."""
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
import json
|
||||
@ -81,7 +82,7 @@ class Updater(JsonConfig, CoreSysAttributes):
|
||||
async with self.sys_websession.get(url, timeout=10) as request:
|
||||
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)
|
||||
raise HassioUpdaterError() from None
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Tools file for HassIO."""
|
||||
import asyncio
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import logging
|
||||
import re
|
||||
@ -30,7 +31,7 @@ async def fetch_timezone(websession):
|
||||
async with websession.get(FREEGEOIP_URL, timeout=10) as request:
|
||||
data = await request.json()
|
||||
|
||||
except aiohttp.ClientError as err:
|
||||
except (aiohttp.ClientError, asyncio.TimeoutError) as err:
|
||||
_LOGGER.warning("Can't fetch freegeoip data: %s", err)
|
||||
|
||||
except ValueError as err:
|
||||
|
Loading…
x
Reference in New Issue
Block a user