Merge pull request #1995 from home-assistant/dev

Release 238
This commit is contained in:
Pascal Vizeli 2020-08-29 15:11:48 +02:00 committed by GitHub
commit dd3ba93308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 12 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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."""

View File

@ -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

View File

@ -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):