From a51b80f456f1044dbe9cb838bbac4552efb9e0b9 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 11 Aug 2020 10:52:33 +0200 Subject: [PATCH] Tag installation type & more infos (#1887) * Tag installation type & more infos * fix black * Make sure dbus is available for reports * HassOS warning -> info * Fix installation type name * fix correct ADR * change name * make message more friendly --- supervisor/bootstrap.py | 6 ++++++ supervisor/const.py | 1 + supervisor/core.py | 9 ++++++++- supervisor/hassos.py | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/supervisor/bootstrap.py b/supervisor/bootstrap.py index e87175c3b..ec885a67d 100644 --- a/supervisor/bootstrap.py +++ b/supervisor/bootstrap.py @@ -301,6 +301,8 @@ def setup_diagnostics(coresys: CoreSys) -> None: "channel": coresys.updater.channel, "supervisor": coresys.supervisor.version, "os": coresys.hassos.version, + "host": coresys.host.info.operating_system, + "kernel": coresys.host.info.kernel, "core": coresys.homeassistant.version, "audio": coresys.plugins.audio.version, "dns": coresys.plugins.dns.version, @@ -308,6 +310,10 @@ def setup_diagnostics(coresys: CoreSys) -> None: "cli": coresys.plugins.cli.version, }, ) + scope.set_tag( + "installation_type", + f"{'os' if coresys.hassos.available else 'supervised'}", + ) return event diff --git a/supervisor/const.py b/supervisor/const.py index 8312d2a42..02b8b1a01 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -32,6 +32,7 @@ FILE_HASSIO_MULTICAST = Path(SUPERVISOR_DATA, "multicast.json") MACHINE_ID = Path("/etc/machine-id") SOCKET_DOCKER = Path("/run/docker.sock") +SOCKET_DBUS = Path("/run/dbus/system_bus_socket") DOCKER_NETWORK = "hassio" DOCKER_NETWORK_MASK = ip_network("172.30.32.0/23") diff --git a/supervisor/core.py b/supervisor/core.py index 19e21ad0f..b9a824530 100644 --- a/supervisor/core.py +++ b/supervisor/core.py @@ -5,7 +5,7 @@ import logging import async_timeout -from .const import AddonStartup, CoreStates +from .const import SOCKET_DBUS, AddonStartup, CoreStates from .coresys import CoreSys, CoreSysAttributes from .exceptions import HassioError, HomeAssistantError, SupervisorUpdateError @@ -47,6 +47,13 @@ class Core(CoreSysAttributes): self.sys_docker.info.check_requirements() + # Dbus available + if not SOCKET_DBUS.exists(): + self.healthy = False + _LOGGER.critical( + "DBus is required for Home Assistant. This system is not supported!" + ) + # Check if system is healthy if not self.healthy: _LOGGER.critical( diff --git a/supervisor/hassos.py b/supervisor/hassos.py index 0ba2f54d5..ee3bb2c95 100644 --- a/supervisor/hassos.py +++ b/supervisor/hassos.py @@ -97,7 +97,7 @@ class HassOS(CoreSysAttributes): if cpe.get_product()[0] != "hassos": raise NotImplementedError() except NotImplementedError: - _LOGGER.warning("No Home Assistant Operating System found!") + _LOGGER.info("No Home Assistant Operating System found") return else: self._available = True