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
if str(value).startswith("!secret "):
secret: str = value.partition(" ")[2]
value = coresys.secrets.get(secret)
value = coresys.homeassistant.secrets.get(secret)
if value is 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 pathlib import Path
SUPERVISOR_VERSION = "237"
SUPERVISOR_VERSION = "238"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"

View File

@ -45,6 +45,10 @@ class Core(CoreSysAttributes):
_LOGGER.error(
"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():
self.supported = False
@ -145,7 +149,7 @@ class Core(CoreSysAttributes):
# Check if image names from denylist exist
try:
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
self.coresys.supported = False
self.supported = False
self.healthy = False
except DockerAPIError:
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:
return None
event.setdefault("extra", {}).update({"os.environ": dict(os.environ)})
# Not full startup - missing information
if coresys.core.state in (CoreState.INITIALIZE, CoreState.SETUP):
return event

View File

@ -41,12 +41,6 @@ class Supervisor(CoreSysAttributes):
with suppress(DockerAPIError):
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
def ip_address(self) -> IPv4Address:
"""Return IP of Supervisor instance."""

View File

@ -153,8 +153,7 @@ class DBus:
try:
return json.loads(json_raw)
except json.JSONDecodeError as err:
_LOGGER.error("Can't parse '%s': %s", json_raw, err)
_LOGGER.debug("GVariant data: '%s'", raw)
_LOGGER.critical("Can't parse '%s': '%s' - %s", json_raw, raw, err)
raise DBusParseError() from err
@staticmethod

View File

@ -1,11 +1,21 @@
"""Test sentry data filter."""
import os
from unittest.mock import patch
import pytest
from supervisor.const import SUPERVISOR_VERSION, CoreState
from supervisor.exceptions import AddonConfigurationError
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):