Merge pull request #1567 from home-assistant/dev

Release 208
This commit is contained in:
Pascal Vizeli 2020-03-04 19:08:12 +01:00 committed by GitHub
commit d62aabc01b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 25 deletions

View File

@ -30,8 +30,7 @@ if __name__ == "__main__":
loop = initialize_event_loop()
# Check if all information are available to setup Supervisor
if not bootstrap.check_environment():
sys.exit(1)
bootstrap.check_environment()
# init executor pool
executor = ThreadPoolExecutor(thread_name_prefix="SyncWorker")

View File

@ -188,13 +188,6 @@ class Audio(JsonConfig, CoreSysAttributes):
"""
return self.instance.is_running()
def is_fails(self) -> Awaitable[bool]:
"""Return True if a Docker container is fails state.
Return a coroutine.
"""
return self.instance.is_fails()
async def repair(self) -> None:
"""Repair CoreDNS plugin."""
if await self.instance.exists():

View File

@ -197,7 +197,7 @@ def initialize_logging():
)
def check_environment():
def check_environment() -> None:
"""Check if all environment are exists."""
# check environment variables
for key in (ENV_SHARE, ENV_NAME, ENV_REPO):
@ -205,24 +205,18 @@ def check_environment():
os.environ[key]
except KeyError:
_LOGGER.fatal("Can't find %s in env!", key)
return False
# check docker socket
if not SOCKET_DOCKER.is_socket():
_LOGGER.fatal("Can't find Docker socket!")
return False
# check socat exec
if not shutil.which("socat"):
_LOGGER.fatal("Can't find socat!")
return False
# check socat exec
if not shutil.which("gdbus"):
_LOGGER.fatal("Can't find gdbus!")
return False
return True
def reg_signal(loop):

View File

@ -3,7 +3,7 @@ from enum import Enum
from ipaddress import ip_network
from pathlib import Path
SUPERVISOR_VERSION = "207"
SUPERVISOR_VERSION = "208"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
@ -28,7 +28,7 @@ FILE_HASSIO_INGRESS = Path(SUPERVISOR_DATA, "ingress.json")
FILE_HASSIO_DNS = Path(SUPERVISOR_DATA, "dns.json")
FILE_HASSIO_AUDIO = Path(SUPERVISOR_DATA, "audio.json")
SOCKET_DOCKER = Path("/var/run/docker.sock")
SOCKET_DOCKER = Path("/run/docker.sock")
DOCKER_NETWORK = "hassio"
DOCKER_NETWORK_MASK = ip_network("172.30.32.0/23")

View File

@ -19,20 +19,25 @@ class HwMonitor(CoreSysAttributes):
"""Initialize Hardware Monitor object."""
self.coresys: CoreSys = coresys
self.context = pyudev.Context()
self.monitor = pyudev.Monitor.from_netlink(self.context)
self.monitor: Optional[pyudev.Monitor] = None
self.observer: Optional[pyudev.MonitorObserver] = None
async def load(self) -> None:
"""Start hardware monitor."""
self.observer = pyudev.MonitorObserver(self.monitor, self._udev_events)
self.observer.start()
_LOGGER.info("Start Supervisor hardware monitor")
try:
self.monitor = pyudev.Monitor.from_netlink(self.context)
self.observer = pyudev.MonitorObserver(self.monitor, self._udev_events)
except OSError:
_LOGGER.fatal("Not privileged to run udev. Update your installation!")
else:
self.observer.start()
_LOGGER.info("Started Supervisor hardware monitor")
async def unload(self) -> None:
"""Shutdown sessions."""
if self.observer is None:
return
self.observer.stop()
_LOGGER.info("Stop Supervisor hardware monitor")

View File

@ -228,7 +228,7 @@ class Tasks(CoreSysAttributes):
async def _watchdog_dns_docker(self):
"""Check running state of Docker and start if they is close."""
# if CoreDNS is active
if await self.sys_dns.is_running():
if await self.sys_dns.is_running() or self.sys_dns.in_progress:
return
_LOGGER.warning("Watchdog found a problem with CoreDNS plugin!")
@ -244,7 +244,7 @@ class Tasks(CoreSysAttributes):
async def _watchdog_audio_docker(self):
"""Check running state of Docker and start if they is close."""
# if PulseAudio plugin is active
if await self.sys_audio.is_running():
if await self.sys_audio.is_running() or self.sys_audio.in_progress:
return
_LOGGER.warning("Watchdog found a problem with PulseAudio plugin!")