mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 19:16:29 +00:00
commit
dd3ba93308
@ -387,7 +387,7 @@ def _single_validate(coresys: CoreSys, typ: str, value: Any, key: str):
|
|||||||
# Lookup secret
|
# Lookup secret
|
||||||
if str(value).startswith("!secret "):
|
if str(value).startswith("!secret "):
|
||||||
secret: str = value.partition(" ")[2]
|
secret: str = value.partition(" ")[2]
|
||||||
value = coresys.secrets.get(secret)
|
value = coresys.homeassistant.secrets.get(secret)
|
||||||
if value is None:
|
if value is None:
|
||||||
raise vol.Invalid(f"Unknown secret {secret}") from None
|
raise vol.Invalid(f"Unknown secret {secret}") from None
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ from enum import Enum
|
|||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SUPERVISOR_VERSION = "237"
|
SUPERVISOR_VERSION = "238"
|
||||||
|
|
||||||
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
||||||
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
|
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
|
||||||
|
@ -45,6 +45,10 @@ class Core(CoreSysAttributes):
|
|||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Detected Docker running inside LXC. Running Home Assistant with the Supervisor on LXC is not supported!"
|
"Detected Docker running inside LXC. Running Home Assistant with the Supervisor on LXC is not supported!"
|
||||||
)
|
)
|
||||||
|
elif not self.sys_supervisor.instance.privileged:
|
||||||
|
self.supported = False
|
||||||
|
self.healthy = False
|
||||||
|
_LOGGER.error("Supervisor does not run in Privileged mode.")
|
||||||
|
|
||||||
if self.sys_docker.info.check_requirements():
|
if self.sys_docker.info.check_requirements():
|
||||||
self.supported = False
|
self.supported = False
|
||||||
@ -145,7 +149,7 @@ class Core(CoreSysAttributes):
|
|||||||
# Check if image names from denylist exist
|
# Check if image names from denylist exist
|
||||||
try:
|
try:
|
||||||
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
|
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
|
||||||
self.coresys.supported = False
|
self.supported = False
|
||||||
self.healthy = False
|
self.healthy = False
|
||||||
except DockerAPIError:
|
except DockerAPIError:
|
||||||
self.healthy = False
|
self.healthy = False
|
||||||
|
@ -34,6 +34,8 @@ def filter_data(coresys: CoreSys, event: dict, hint: dict) -> dict:
|
|||||||
if not coresys.config.diagnostics or not coresys.core.supported or dev_env:
|
if not coresys.config.diagnostics or not coresys.core.supported or dev_env:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
event.setdefault("extra", {}).update({"os.environ": dict(os.environ)})
|
||||||
|
|
||||||
# Not full startup - missing information
|
# Not full startup - missing information
|
||||||
if coresys.core.state in (CoreState.INITIALIZE, CoreState.SETUP):
|
if coresys.core.state in (CoreState.INITIALIZE, CoreState.SETUP):
|
||||||
return event
|
return event
|
||||||
|
@ -41,12 +41,6 @@ class Supervisor(CoreSysAttributes):
|
|||||||
with suppress(DockerAPIError):
|
with suppress(DockerAPIError):
|
||||||
await self.instance.cleanup()
|
await self.instance.cleanup()
|
||||||
|
|
||||||
# Check privileged mode
|
|
||||||
if not self.instance.privileged:
|
|
||||||
_LOGGER.error(
|
|
||||||
"Supervisor does not run in Privileged mode. Hassio runs with limited functionality!"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self) -> IPv4Address:
|
def ip_address(self) -> IPv4Address:
|
||||||
"""Return IP of Supervisor instance."""
|
"""Return IP of Supervisor instance."""
|
||||||
|
@ -153,8 +153,7 @@ class DBus:
|
|||||||
try:
|
try:
|
||||||
return json.loads(json_raw)
|
return json.loads(json_raw)
|
||||||
except json.JSONDecodeError as err:
|
except json.JSONDecodeError as err:
|
||||||
_LOGGER.error("Can't parse '%s': %s", json_raw, err)
|
_LOGGER.critical("Can't parse '%s': '%s' - %s", json_raw, raw, err)
|
||||||
_LOGGER.debug("GVariant data: '%s'", raw)
|
|
||||||
raise DBusParseError() from err
|
raise DBusParseError() from err
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
"""Test sentry data filter."""
|
"""Test sentry data filter."""
|
||||||
|
import os
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from supervisor.const import SUPERVISOR_VERSION, CoreState
|
from supervisor.const import SUPERVISOR_VERSION, CoreState
|
||||||
from supervisor.exceptions import AddonConfigurationError
|
from supervisor.exceptions import AddonConfigurationError
|
||||||
from supervisor.misc.filter import filter_data
|
from supervisor.misc.filter import filter_data
|
||||||
|
|
||||||
SAMPLE_EVENT = {"sample": "event"}
|
SAMPLE_EVENT = {"sample": "event", "extra": {"Test": "123"}}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def sys_env(autouse=True):
|
||||||
|
"""Fixture to inject hassio env."""
|
||||||
|
with patch.dict(os.environ, {"Test": "123"}):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
def test_ignored_exception(coresys):
|
def test_ignored_exception(coresys):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user