Log messages cleanup (#2129)

* Log cleanup

* More logs
This commit is contained in:
Joakim Sørensen 2020-10-15 14:50:43 +02:00 committed by GitHub
parent 034393bd42
commit fe0e41adec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 287 additions and 239 deletions

View File

@ -5,7 +5,7 @@
declare failed_count=0 declare failed_count=0
declare supervisor_state declare supervisor_state
bashio::log.info "Start local supervisor watchdog..." bashio::log.info "Starting local supervisor watchdog..."
while [[ failed_count -lt 2 ]]; while [[ failed_count -lt 2 ]];
do do
@ -31,4 +31,4 @@ do
done done
basio::exit.nok "Watchdog detect issue with Supervisor - take container down!" basio::exit.nok "Watchdog detected issue with Supervisor - taking container down!"

View File

@ -36,24 +36,24 @@ if __name__ == "__main__":
executor = ThreadPoolExecutor(thread_name_prefix="SyncWorker") executor = ThreadPoolExecutor(thread_name_prefix="SyncWorker")
loop.set_default_executor(executor) loop.set_default_executor(executor)
_LOGGER.info("Initialize Supervisor setup") _LOGGER.info("Initializing Supervisor setup")
coresys = loop.run_until_complete(bootstrap.initialize_coresys()) coresys = loop.run_until_complete(bootstrap.initialize_coresys())
loop.run_until_complete(coresys.core.connect()) loop.run_until_complete(coresys.core.connect())
bootstrap.supervisor_debugger(coresys) bootstrap.supervisor_debugger(coresys)
bootstrap.migrate_system_env(coresys) bootstrap.migrate_system_env(coresys)
_LOGGER.info("Setup Supervisor") _LOGGER.info("Setting up Supervisor")
loop.run_until_complete(coresys.core.setup()) loop.run_until_complete(coresys.core.setup())
loop.call_soon_threadsafe(loop.create_task, coresys.core.start()) loop.call_soon_threadsafe(loop.create_task, coresys.core.start())
loop.call_soon_threadsafe(bootstrap.reg_signal, loop, coresys) loop.call_soon_threadsafe(bootstrap.reg_signal, loop, coresys)
try: try:
_LOGGER.info("Run Supervisor") _LOGGER.info("Running Supervisor")
loop.run_forever() loop.run_forever()
finally: finally:
loop.close() loop.close()
_LOGGER.info("Close Supervisor") _LOGGER.info("Closing Supervisor")
sys.exit(0) sys.exit(0)

View File

@ -93,7 +93,7 @@ class AddonManager(CoreSysAttributes):
tasks.append(addon) tasks.append(addon)
# Evaluate add-ons which need to be started # Evaluate add-ons which need to be started
_LOGGER.info("Phase '%s' start %d add-ons", stage, len(tasks)) _LOGGER.info("Phase '%s' starting %d add-ons", stage, len(tasks))
if not tasks: if not tasks:
return return
@ -127,7 +127,7 @@ class AddonManager(CoreSysAttributes):
tasks.append(addon) tasks.append(addon)
# Evaluate add-ons which need to be stopped # Evaluate add-ons which need to be stopped
_LOGGER.info("Phase '%s' stop %d add-ons", stage, len(tasks)) _LOGGER.info("Phase '%s' stopping %d add-ons", stage, len(tasks))
if not tasks: if not tasks:
return return
@ -159,7 +159,9 @@ class AddonManager(CoreSysAttributes):
addon = Addon(self.coresys, slug) addon = Addon(self.coresys, slug)
if not addon.path_data.is_dir(): if not addon.path_data.is_dir():
_LOGGER.info("Create Home Assistant add-on data folder %s", addon.path_data) _LOGGER.info(
"Creating Home Assistant add-on data folder %s", addon.path_data
)
addon.path_data.mkdir() addon.path_data.mkdir()
# Setup/Fix AppArmor profile # Setup/Fix AppArmor profile
@ -346,7 +348,7 @@ class AddonManager(CoreSysAttributes):
return return
for addon in needs_repair: for addon in needs_repair:
_LOGGER.info("Start repair for add-on: %s", addon.slug) _LOGGER.info("Repairing for add-on: %s", addon.slug)
await self.sys_run_in_executor( await self.sys_run_in_executor(
self.sys_docker.network.stale_cleanup, addon.instance.name self.sys_docker.network.stale_cleanup, addon.instance.name
) )

View File

@ -463,7 +463,7 @@ class Addon(AddonModel):
if not self.path_data.is_dir(): if not self.path_data.is_dir():
return return
_LOGGER.info("Remove add-on data folder %s", self.path_data) _LOGGER.info("Removing add-on data folder %s", self.path_data)
await remove_data(self.path_data) await remove_data(self.path_data)
def write_pulse(self) -> None: def write_pulse(self) -> None:
@ -545,7 +545,7 @@ class Addon(AddonModel):
async def start(self) -> None: async def start(self) -> None:
"""Set options and start add-on.""" """Set options and start add-on."""
if await self.instance.is_running(): if await self.instance.is_running():
_LOGGER.warning("%s already running!", self.slug) _LOGGER.warning("%s is already running!", self.slug)
return return
# Access Token # Access Token
@ -676,7 +676,7 @@ class Addon(AddonModel):
) )
try: try:
_LOGGER.info("Build snapshot for add-on %s", self.slug) _LOGGER.info("Building snapshot for add-on %s", self.slug)
await self.sys_run_in_executor(_write_tarfile) await self.sys_run_in_executor(_write_tarfile)
except (tarfile.TarError, OSError) as err: except (tarfile.TarError, OSError) as err:
_LOGGER.error("Can't write tarfile %s: %s", tar_file, err) _LOGGER.error("Can't write tarfile %s: %s", tar_file, err)
@ -731,7 +731,7 @@ class Addon(AddonModel):
# Check version / restore image # Check version / restore image
version = data[ATTR_VERSION] version = data[ATTR_VERSION]
if not await self.instance.exists(): if not await self.instance.exists():
_LOGGER.info("Restore/Install image for addon %s", self.slug) _LOGGER.info("Restore/Install of image for addon %s", self.slug)
image_file = Path(temp, "image.tar") image_file = Path(temp, "image.tar")
if image_file.is_file(): if image_file.is_file():
@ -742,7 +742,7 @@ class Addon(AddonModel):
await self.instance.install(version, restore_image) await self.instance.install(version, restore_image)
await self.instance.cleanup() await self.instance.cleanup()
elif self.instance.version != version or self.legacy: elif self.instance.version != version or self.legacy:
_LOGGER.info("Restore/Update image for addon %s", self.slug) _LOGGER.info("Restore/Update of image for addon %s", self.slug)
with suppress(DockerError): with suppress(DockerError):
await self.instance.update(version, restore_image) await self.instance.update(version, restore_image)
else: else:
@ -754,7 +754,7 @@ class Addon(AddonModel):
"""Restore data.""" """Restore data."""
shutil.copytree(Path(temp, "data"), self.path_data, symlinks=True) shutil.copytree(Path(temp, "data"), self.path_data, symlinks=True)
_LOGGER.info("Restore data for addon %s", self.slug) _LOGGER.info("Restoring data for addon %s", self.slug)
if self.path_data.is_dir(): if self.path_data.is_dir():
await remove_data(self.path_data) await remove_data(self.path_data)
try: try:
@ -778,4 +778,4 @@ class Addon(AddonModel):
if data[ATTR_STATE] == AddonState.STARTED: if data[ATTR_STATE] == AddonState.STARTED:
return await self.start() return await self.start()
_LOGGER.info("Finish restore for add-on %s", self.slug) _LOGGER.info("Finished restore for add-on %s", self.slug)

View File

@ -459,7 +459,7 @@ class RestAPI(CoreSysAttributes):
except OSError as err: except OSError as err:
_LOGGER.critical("Failed to create HTTP server at 0.0.0.0:80 -> %s", err) _LOGGER.critical("Failed to create HTTP server at 0.0.0.0:80 -> %s", err)
else: else:
_LOGGER.info("Start API on %s", self.sys_docker.network.supervisor) _LOGGER.info("Starting API on %s", self.sys_docker.network.supervisor)
async def stop(self) -> None: async def stop(self) -> None:
"""Stop RESTful API webserver.""" """Stop RESTful API webserver."""
@ -470,4 +470,4 @@ class RestAPI(CoreSysAttributes):
await self._site.stop() await self._site.stop()
await self._runner.cleanup() await self._runner.cleanup()
_LOGGER.info("Stop API on %s", self.sys_docker.network.supervisor) _LOGGER.info("Stopping API on %s", self.sys_docker.network.supervisor)

View File

@ -339,7 +339,7 @@ class APIAddons(CoreSysAttributes):
body: Dict[str, Any] = await api_validate(SCHEMA_SECURITY, request) body: Dict[str, Any] = await api_validate(SCHEMA_SECURITY, request)
if ATTR_PROTECTED in body: if ATTR_PROTECTED in body:
_LOGGER.warning("Protected flag changing for %s!", addon.slug) _LOGGER.warning("Changing protected flag for %s!", addon.slug)
addon.protected = body[ATTR_PROTECTED] addon.protected = body[ATTR_PROTECTED]
addon.save_persist() addon.save_persist()

View File

@ -124,7 +124,9 @@ class APIProxy(CoreSysAttributes):
if data.get("type") != "auth_required": if data.get("type") != "auth_required":
# Invalid protocol # Invalid protocol
_LOGGER.error("Got unexpected response from HA WebSocket: %s", data) _LOGGER.error(
"Got unexpected response from Home Assistant WebSocket: %s", data
)
raise APIError() raise APIError()
# Auth session # Auth session

View File

@ -139,7 +139,7 @@ class SecurityMiddleware(CoreSysAttributes):
# Blacklist # Blacklist
if BLACKLIST.match(request.path): if BLACKLIST.match(request.path):
_LOGGER.warning("%s is blacklisted!", request.path) _LOGGER.error("%s is blacklisted!", request.path)
raise HTTPForbidden() raise HTTPForbidden()
# Ignore security check # Ignore security check

View File

@ -175,7 +175,7 @@ class APISnapshots(CoreSysAttributes):
"""Download a snapshot file.""" """Download a snapshot file."""
snapshot = self._extract_snapshot(request) snapshot = self._extract_snapshot(request)
_LOGGER.info("Download snapshot %s", snapshot.slug) _LOGGER.info("Downloading snapshot %s", snapshot.slug)
response = web.FileResponse(snapshot.tarfile) response = web.FileResponse(snapshot.tarfile)
response.content_type = CONTENT_TYPE_TAR response.content_type = CONTENT_TYPE_TAR
response.headers[ response.headers[

View File

@ -51,14 +51,14 @@ class CpuArch(CoreSysAttributes):
try: try:
arch_data = read_json_file(ARCH_JSON) arch_data = read_json_file(ARCH_JSON)
except JsonFileError: except JsonFileError:
_LOGGER.warning("Can't read arch json") _LOGGER.warning("Can't read arch json file from %s", ARCH_JSON)
return return
native_support = self.detect_cpu() native_support = self.detect_cpu()
# Evaluate current CPU/Platform # Evaluate current CPU/Platform
if not self.sys_machine or self.sys_machine not in arch_data: if not self.sys_machine or self.sys_machine not in arch_data:
_LOGGER.warning("Can't detect underlay machine type!") _LOGGER.warning("Can't detect the machine type!")
self._default_arch = native_support self._default_arch = native_support
self._supported_arch.append(self.default) self._supported_arch.append(self.default)
return return

View File

@ -26,10 +26,10 @@ class Auth(JsonConfig, CoreSysAttributes):
password_h = self._rehash(password, username) password_h = self._rehash(password, username)
if self._data.get(username_h) == password_h: if self._data.get(username_h) == password_h:
_LOGGER.info("Cache hit for %s", username) _LOGGER.debug("Username '%s' is in cache", username)
return True return True
_LOGGER.warning("No cache hit for %s", username) _LOGGER.warning("Username '%s' not is in cache", username)
return False return False
def _update_cache(self, username: str, password: str) -> None: def _update_cache(self, username: str, password: str) -> None:
@ -59,11 +59,11 @@ class Auth(JsonConfig, CoreSysAttributes):
if password is None: if password is None:
_LOGGER.error("None as password is not supported!") _LOGGER.error("None as password is not supported!")
raise AuthError() raise AuthError()
_LOGGER.info("Auth request from %s for %s", addon.slug, username) _LOGGER.info("Auth request from '%s' for '%s'", addon.slug, username)
# Check API state # Check API state
if not await self.sys_homeassistant.api.check_api_state(): if not await self.sys_homeassistant.api.check_api_state():
_LOGGER.info("Home Assistant not running, check cache") _LOGGER.debug("Home Assistant not running, checking cache")
return self._check_cache(username, password) return self._check_cache(username, password)
try: try:
@ -78,11 +78,11 @@ class Auth(JsonConfig, CoreSysAttributes):
) as req: ) as req:
if req.status == 200: if req.status == 200:
_LOGGER.info("Success login from %s", username) _LOGGER.info("Successful login for '%s'", username)
self._update_cache(username, password) self._update_cache(username, password)
return True return True
_LOGGER.warning("Wrong login from %s", username) _LOGGER.warning("Unauthorized login for '%s'", username)
self._dismatch_cache(username, password) self._dismatch_cache(username, password)
return False return False
except HomeAssistantAPIError: except HomeAssistantAPIError:
@ -99,10 +99,10 @@ class Auth(JsonConfig, CoreSysAttributes):
json={ATTR_USERNAME: username, ATTR_PASSWORD: password}, json={ATTR_USERNAME: username, ATTR_PASSWORD: password},
) as req: ) as req:
if req.status == 200: if req.status == 200:
_LOGGER.info("Success password reset %s", username) _LOGGER.info("Successful password reset for '%s'", username)
return return
_LOGGER.warning("Unknown user %s for password reset", username) _LOGGER.warning("The user '%s' is not registered", username)
except HomeAssistantAPIError: except HomeAssistantAPIError:
_LOGGER.error("Can't request password reset on Home Assistant!") _LOGGER.error("Can't request password reset on Home Assistant!")

View File

@ -96,7 +96,7 @@ async def initialize_coresys() -> CoreSys:
coresys.machine = os.environ[ENV_SUPERVISOR_MACHINE] coresys.machine = os.environ[ENV_SUPERVISOR_MACHINE]
elif os.environ.get(ENV_HOMEASSISTANT_REPOSITORY): elif os.environ.get(ENV_HOMEASSISTANT_REPOSITORY):
coresys.machine = os.environ[ENV_HOMEASSISTANT_REPOSITORY][14:-14] coresys.machine = os.environ[ENV_HOMEASSISTANT_REPOSITORY][14:-14]
_LOGGER.info("Setup coresys for machine: %s", coresys.machine) _LOGGER.debug("Seting up coresys for machine: %s", coresys.machine)
return coresys return coresys
@ -107,68 +107,73 @@ def initialize_system_data(coresys: CoreSys) -> None:
# Home Assistant configuration folder # Home Assistant configuration folder
if not config.path_homeassistant.is_dir(): if not config.path_homeassistant.is_dir():
_LOGGER.info( _LOGGER.debug(
"Create Home Assistant configuration folder %s", config.path_homeassistant "Creating Home Assistant configuration folder at '%s'",
config.path_homeassistant,
) )
config.path_homeassistant.mkdir() config.path_homeassistant.mkdir()
# Supervisor ssl folder # Supervisor ssl folder
if not config.path_ssl.is_dir(): if not config.path_ssl.is_dir():
_LOGGER.info("Create Supervisor SSL/TLS folder %s", config.path_ssl) _LOGGER.debug("Creating Supervisor SSL/TLS folder at '%s'", config.path_ssl)
config.path_ssl.mkdir() config.path_ssl.mkdir()
# Supervisor addon data folder # Supervisor addon data folder
if not config.path_addons_data.is_dir(): if not config.path_addons_data.is_dir():
_LOGGER.info("Create Supervisor Add-on data folder %s", config.path_addons_data) _LOGGER.info(
"Creating Supervisor Add-on data folder at '%s'", config.path_addons_data
)
config.path_addons_data.mkdir(parents=True) config.path_addons_data.mkdir(parents=True)
if not config.path_addons_local.is_dir(): if not config.path_addons_local.is_dir():
_LOGGER.info( _LOGGER.debug(
"Create Supervisor Add-on local repository folder %s", "Creating Supervisor Add-on local repository folder at '%s'",
config.path_addons_local, config.path_addons_local,
) )
config.path_addons_local.mkdir(parents=True) config.path_addons_local.mkdir(parents=True)
if not config.path_addons_git.is_dir(): if not config.path_addons_git.is_dir():
_LOGGER.info( _LOGGER.debug(
"Create Supervisor Add-on git repositories folder %s", "Creating Supervisor Add-on git repositories folder at '%s'",
config.path_addons_git, config.path_addons_git,
) )
config.path_addons_git.mkdir(parents=True) config.path_addons_git.mkdir(parents=True)
# Supervisor tmp folder # Supervisor tmp folder
if not config.path_tmp.is_dir(): if not config.path_tmp.is_dir():
_LOGGER.info("Create Supervisor temp folder %s", config.path_tmp) _LOGGER.debug("Creating Supervisor temp folder at '%s'", config.path_tmp)
config.path_tmp.mkdir(parents=True) config.path_tmp.mkdir(parents=True)
# Supervisor backup folder # Supervisor backup folder
if not config.path_backup.is_dir(): if not config.path_backup.is_dir():
_LOGGER.info("Create Supervisor backup folder %s", config.path_backup) _LOGGER.debug("Creating Supervisor backup folder at '%s'", config.path_backup)
config.path_backup.mkdir() config.path_backup.mkdir()
# Share folder # Share folder
if not config.path_share.is_dir(): if not config.path_share.is_dir():
_LOGGER.info("Create Supervisor share folder %s", config.path_share) _LOGGER.debug("Creating Supervisor share folder at '%s'", config.path_share)
config.path_share.mkdir() config.path_share.mkdir()
# Apparmor folder # Apparmor folder
if not config.path_apparmor.is_dir(): if not config.path_apparmor.is_dir():
_LOGGER.info("Create Supervisor Apparmor folder %s", config.path_apparmor) _LOGGER.debug(
"Creating Supervisor Apparmor folder at '%s'", config.path_apparmor
)
config.path_apparmor.mkdir() config.path_apparmor.mkdir()
# DNS folder # DNS folder
if not config.path_dns.is_dir(): if not config.path_dns.is_dir():
_LOGGER.info("Create Supervisor DNS folder %s", config.path_dns) _LOGGER.debug("Creating Supervisor DNS folder at '%s'", config.path_dns)
config.path_dns.mkdir() config.path_dns.mkdir()
# Audio folder # Audio folder
if not config.path_audio.is_dir(): if not config.path_audio.is_dir():
_LOGGER.info("Create Supervisor audio folder %s", config.path_audio) _LOGGER.debug("Creating Supervisor audio folder at '%s'", config.path_audio)
config.path_audio.mkdir() config.path_audio.mkdir()
# Media folder # Media folder
if not config.path_media.is_dir(): if not config.path_media.is_dir():
_LOGGER.info("Create Supervisor media folder %s", config.path_media) _LOGGER.debug("Creating Supervisor media folder at '%s'", config.path_media)
config.path_media.mkdir() config.path_media.mkdir()
# Update log level # Update log level
@ -176,7 +181,7 @@ def initialize_system_data(coresys: CoreSys) -> None:
# Check if ENV is in development mode # Check if ENV is in development mode
if bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)): if bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)):
_LOGGER.warning("SUPERVISOR_DEV is set") _LOGGER.warning("Environment variables 'SUPERVISOR_DEV' is set")
coresys.updater.channel = UpdateChannel.DEV coresys.updater.channel = UpdateChannel.DEV
coresys.config.logging = LogLevel.DEBUG coresys.config.logging = LogLevel.DEBUG
coresys.config.debug = True coresys.config.debug = True
@ -192,7 +197,7 @@ def migrate_system_env(coresys: CoreSys) -> None:
try: try:
old_build.rmdir() old_build.rmdir()
except OSError: except OSError:
_LOGGER.warning("Can't cleanup old Add-on build directory") _LOGGER.error("Can't cleanup old Add-on build directory at '%s'", old_build)
def initialize_logging() -> None: def initialize_logging() -> None:
@ -228,7 +233,7 @@ def check_environment() -> None:
try: try:
os.environ[key] os.environ[key]
except KeyError: except KeyError:
_LOGGER.critical("Can't find %s in env!", key) _LOGGER.critical("Can't find '%s' environment variable!", key)
# Check Machine info # Check Machine info
if not os.environ.get(ENV_HOMEASSISTANT_REPOSITORY) and not os.environ.get( if not os.environ.get(ENV_HOMEASSISTANT_REPOSITORY) and not os.environ.get(
@ -278,11 +283,11 @@ def supervisor_debugger(coresys: CoreSys) -> None:
# pylint: disable=import-outside-toplevel # pylint: disable=import-outside-toplevel
import debugpy import debugpy
_LOGGER.info("Initialize Supervisor debugger") _LOGGER.info("Initializing Supervisor debugger")
debugpy.listen(("0.0.0.0", 33333)) debugpy.listen(("0.0.0.0", 33333))
if coresys.config.debug_block: if coresys.config.debug_block:
_LOGGER.info("Wait until debugger is attached") _LOGGER.debug("Wait until debugger is attached")
debugpy.wait_for_client() debugpy.wait_for_client()
@ -292,7 +297,7 @@ def setup_diagnostics(coresys: CoreSys) -> None:
level=logging.WARNING, event_level=logging.CRITICAL level=logging.WARNING, event_level=logging.CRITICAL
) )
_LOGGER.info("Initialize Supervisor Sentry") _LOGGER.info("Initializing Supervisor Sentry")
sentry_sdk.init( sentry_sdk.init(
dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612", dsn="https://9c6ea70f49234442b4746e447b24747e@o427061.ingest.sentry.io/5370612",
before_send=lambda event, hint: filter_data(coresys, event, hint), before_send=lambda event, hint: filter_data(coresys, event, hint),

View File

@ -52,7 +52,9 @@ class Core(CoreSysAttributes):
try: try:
RUN_SUPERVISOR_STATE.write_text(new_state.value) RUN_SUPERVISOR_STATE.write_text(new_state.value)
except OSError as err: except OSError as err:
_LOGGER.warning("Can't update supervisor state %s: %s", new_state, err) _LOGGER.warning(
"Can't update the Supervisor state to %s: %s", new_state, err
)
finally: finally:
self._state = new_state self._state = new_state
@ -68,7 +70,7 @@ class Core(CoreSysAttributes):
self.sys_resolution.unsupported = UnsupportedReason.DOCKER_VERSION self.sys_resolution.unsupported = UnsupportedReason.DOCKER_VERSION
self.healthy = False self.healthy = False
_LOGGER.error( _LOGGER.error(
"Docker version %s is not supported by Supervisor!", "Docker version '%s' is not supported by Supervisor!",
self.sys_docker.info.version, self.sys_docker.info.version,
) )
elif self.sys_docker.info.inside_lxc: elif self.sys_docker.info.inside_lxc:
@ -89,7 +91,7 @@ class Core(CoreSysAttributes):
if not SOCKET_DBUS.exists(): if not SOCKET_DBUS.exists():
self.sys_resolution.unsupported = UnsupportedReason.DBUS self.sys_resolution.unsupported = UnsupportedReason.DBUS
_LOGGER.error( _LOGGER.error(
"DBus is required for Home Assistant. This system is not supported!" "D-Bus is required for Home Assistant. This system is not supported!"
) )
# Check supervisor version/update # Check supervisor version/update
@ -101,13 +103,13 @@ class Core(CoreSysAttributes):
): ):
self.healthy = False self.healthy = False
_LOGGER.warning( _LOGGER.warning(
"Found a development supervisor outside dev channel (%s)", "Found a development Supervisor outside dev channel (%s)",
self.sys_updater.channel, self.sys_updater.channel,
) )
elif self.sys_config.version != self.sys_supervisor.version: elif self.sys_config.version != self.sys_supervisor.version:
self.healthy = False self.healthy = False
_LOGGER.error( _LOGGER.error(
"Update %s of Supervisor %s failed!", "Update '%s' of Supervisor '%s' failed!",
self.sys_config.version, self.sys_config.version,
self.sys_supervisor.version, self.sys_supervisor.version,
) )
@ -174,7 +176,7 @@ class Core(CoreSysAttributes):
# Check Host features # Check Host features
if HostFeature.NETWORK not in self.sys_host.supported_features: if HostFeature.NETWORK not in self.sys_host.supported_features:
self.sys_resolution.unsupported = UnsupportedReason.NETWORK_MANAGER self.sys_resolution.unsupported = UnsupportedReason.NETWORK_MANAGER
_LOGGER.error("NetworkManager is not correct working") _LOGGER.error("NetworkManager is not correctly configured")
if any( if any(
feature not in self.sys_host.supported_features feature not in self.sys_host.supported_features
for feature in ( for feature in (
@ -185,7 +187,7 @@ class Core(CoreSysAttributes):
) )
): ):
self.sys_resolution.unsupported = UnsupportedReason.SYSTEMD self.sys_resolution.unsupported = UnsupportedReason.SYSTEMD
_LOGGER.error("Systemd is not correct working") _LOGGER.error("Systemd is not correctly working")
# Check if image names from denylist exist # Check if image names from denylist exist
try: try:
@ -201,7 +203,7 @@ class Core(CoreSysAttributes):
# Check if system is healthy # Check if system is healthy
if not self.supported: if not self.supported:
_LOGGER.critical("System running in a unsupported environment!") _LOGGER.warning("System running in a unsupported environment!")
if not self.healthy: if not self.healthy:
_LOGGER.critical( _LOGGER.critical(
"System running in a unhealthy state and need manual intervention!" "System running in a unhealthy state and need manual intervention!"
@ -215,13 +217,13 @@ class Core(CoreSysAttributes):
if self.sys_supervisor.need_update: if self.sys_supervisor.need_update:
try: try:
if self.sys_dev or not self.healthy: if self.sys_dev or not self.healthy:
_LOGGER.warning("Ignore Supervisor updates!") _LOGGER.warning("Ignoring Supervisor updates!")
else: else:
await self.sys_supervisor.update() await self.sys_supervisor.update()
return return
except SupervisorUpdateError as err: except SupervisorUpdateError as err:
_LOGGER.critical( _LOGGER.critical(
"Can't update supervisor! This will break some Add-ons or affect " "Can't update Supervisor! This will break some Add-ons or affect "
"future version of Home Assistant!" "future version of Home Assistant!"
) )
self.sys_capture_exception(err) self.sys_capture_exception(err)
@ -232,7 +234,7 @@ class Core(CoreSysAttributes):
try: try:
# HomeAssistant is already running / supervisor have only reboot # HomeAssistant is already running / supervisor have only reboot
if self.sys_hardware.last_boot == self.sys_config.last_boot: if self.sys_hardware.last_boot == self.sys_config.last_boot:
_LOGGER.info("Supervisor reboot detected") _LOGGER.debug("Supervisor reboot detected")
return return
# reset register services / discovery # reset register services / discovery
@ -252,7 +254,7 @@ class Core(CoreSysAttributes):
try: try:
await self.sys_homeassistant.core.start() await self.sys_homeassistant.core.start()
except HomeAssistantCrashError as err: except HomeAssistantCrashError as err:
_LOGGER.warning("Can't start Home Assistant Core - rebuild") _LOGGER.error("Can't start Home Assistant Core - rebuiling")
self.sys_capture_exception(err) self.sys_capture_exception(err)
with suppress(HomeAssistantError): with suppress(HomeAssistantError):
@ -260,7 +262,7 @@ class Core(CoreSysAttributes):
except HomeAssistantError as err: except HomeAssistantError as err:
self.sys_capture_exception(err) self.sys_capture_exception(err)
else: else:
_LOGGER.info("Skip start of Home Assistant") _LOGGER.debug("Skiping start of Home Assistant")
# start addon mark as application # start addon mark as application
await self.sys_addons.boot(AddonStartup.APPLICATION) await self.sys_addons.boot(AddonStartup.APPLICATION)
@ -283,8 +285,8 @@ class Core(CoreSysAttributes):
self.sys_create_task(self.sys_host.reload()) self.sys_create_task(self.sys_host.reload())
self.sys_create_task(self.sys_updater.reload()) self.sys_create_task(self.sys_updater.reload())
_LOGGER.info("Supervisor is up and running")
self.state = CoreState.RUNNING self.state = CoreState.RUNNING
_LOGGER.info("Supervisor is up and running")
async def stop(self): async def stop(self):
"""Stop a running orchestration.""" """Stop a running orchestration."""
@ -318,8 +320,8 @@ class Core(CoreSysAttributes):
except asyncio.TimeoutError: except asyncio.TimeoutError:
_LOGGER.warning("Stage 2: Force Shutdown!") _LOGGER.warning("Stage 2: Force Shutdown!")
_LOGGER.info("Supervisor is down")
self.state = CoreState.CLOSE self.state = CoreState.CLOSE
_LOGGER.info("Supervisor is down")
self.sys_loop.stop() self.sys_loop.stop()
async def shutdown(self): async def shutdown(self):
@ -351,7 +353,7 @@ class Core(CoreSysAttributes):
async def repair(self): async def repair(self):
"""Repair system integrity.""" """Repair system integrity."""
_LOGGER.info("Start repairing of Supervisor Environment") _LOGGER.info("Starting repair of Supervisor Environment")
await self.sys_run_in_executor(self.sys_docker.repair) await self.sys_run_in_executor(self.sys_docker.repair)
# Fix plugins # Fix plugins
@ -363,4 +365,4 @@ class Core(CoreSysAttributes):
# Tag version for latest # Tag version for latest
await self.sys_supervisor.repair() await self.sys_supervisor.repair()
_LOGGER.info("Finished repairing of Supervisor Environment") _LOGGER.info("Finished repair of Supervisor Environment")

View File

@ -53,5 +53,5 @@ class DBusManager(CoreSysAttributes):
await self.network.connect() await self.network.connect()
except DBusNotConnectedError: except DBusNotConnectedError:
_LOGGER.error( _LOGGER.error(
"No DBus support from Host. Disabled any kind of host control!" "No D-Bus support on Host. Disabled any kind of host control!"
) )

View File

@ -51,7 +51,7 @@ class Discovery(CoreSysAttributes, JsonConfig):
discovery = Message(**message) discovery = Message(**message)
messages[discovery.uuid] = discovery messages[discovery.uuid] = discovery
_LOGGER.info("Load %d messages", len(messages)) _LOGGER.info("Loaded %d messages", len(messages))
self.message_obj = messages self.message_obj = messages
def save(self) -> None: def save(self) -> None:
@ -96,7 +96,9 @@ class Discovery(CoreSysAttributes, JsonConfig):
return exists_msg return exists_msg
break break
_LOGGER.info("Send discovery to Home Assistant %s from %s", service, addon.slug) _LOGGER.info(
"Sending discovery to Home Assistant %s from %s", service, addon.slug
)
self.message_obj[message.uuid] = message self.message_obj[message.uuid] = message
self.save() self.save()

View File

@ -167,7 +167,7 @@ class DockerAPI:
try: try:
self.network.attach_container(container, alias=alias, ipv4=ipv4) self.network.attach_container(container, alias=alias, ipv4=ipv4)
except DockerError: except DockerError:
_LOGGER.warning("Can't attach %s to hassio-net!", name) _LOGGER.warning("Can't attach %s to hassio-network!", name)
else: else:
with suppress(DockerError): with suppress(DockerError):
self.network.detach_default_bridge(container) self.network.detach_default_bridge(container)
@ -202,7 +202,7 @@ class DockerAPI:
stdout = kwargs.get("stdout", True) stdout = kwargs.get("stdout", True)
stderr = kwargs.get("stderr", True) stderr = kwargs.get("stderr", True)
_LOGGER.info("Run command '%s' on %s", command, image) _LOGGER.info("Runing command '%s' on %s", command, image)
try: try:
container = self.docker.containers.run( container = self.docker.containers.run(
f"{image}:{version}", f"{image}:{version}",

View File

@ -347,7 +347,7 @@ class DockerAddon(DockerInterface):
# Security check # Security check
if not self.addon.protected: if not self.addon.protected:
_LOGGER.warning("%s run with disabled protected mode!", self.addon.name) _LOGGER.warning("%s running with disabled protected mode!", self.addon.name)
# Cleanup # Cleanup
self._stop() self._stop()
@ -376,7 +376,9 @@ class DockerAddon(DockerInterface):
) )
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info("Start Docker add-on %s with version %s", self.image, self.version) _LOGGER.info(
"Starting Docker add-on %s with version %s", self.image, self.version
)
# Write data to DNS server # Write data to DNS server
try: try:
@ -406,7 +408,7 @@ class DockerAddon(DockerInterface):
""" """
build_env = AddonBuild(self.coresys, self.addon) build_env = AddonBuild(self.coresys, self.addon)
_LOGGER.info("Start build %s:%s", self.image, tag) _LOGGER.info("Starting build for %s:%s", self.image, tag)
try: try:
image, log = self.sys_docker.images.build( image, log = self.sys_docker.images.build(
use_config_proxy=False, **build_env.get_docker_args(tag) use_config_proxy=False, **build_env.get_docker_args(tag)
@ -470,7 +472,7 @@ class DockerAddon(DockerInterface):
raise DockerError() from err raise DockerError() from err
self._meta = docker_image.attrs self._meta = docker_image.attrs
_LOGGER.info("Import image %s and version %s", tar_file, self.version) _LOGGER.info("Importing image %s and version %s", tar_file, self.version)
with suppress(DockerError): with suppress(DockerError):
self._cleanup() self._cleanup()

View File

@ -41,7 +41,7 @@ class DockerAudio(DockerInterface, CoreSysAttributes):
if Path("/dev/snd").exists(): if Path("/dev/snd").exists():
volumes.update({"/dev/snd": {"bind": "/dev/snd", "mode": "rw"}}) volumes.update({"/dev/snd": {"bind": "/dev/snd", "mode": "rw"}})
else: else:
_LOGGER.warning("Kernel have no audio support in") _LOGGER.warning("Kernel have no audio support")
return volumes return volumes
@ -72,7 +72,7 @@ class DockerAudio(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Start Audio %s with version %s - %s", "Starting Audio %s with version %s - %s",
self.image, self.image,
self.version, self.version,
self.sys_docker.network.audio, self.sys_docker.network.audio,

View File

@ -57,7 +57,7 @@ class DockerCli(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Start CLI %s with version %s - %s", "Starting CLI %s with version %s - %s",
self.image, self.image,
self.version, self.version,
self.sys_docker.network.cli, self.sys_docker.network.cli,

View File

@ -52,7 +52,7 @@ class DockerDNS(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Start DNS %s with version %s - %s", "Starting DNS %s with version %s - %s",
self.image, self.image,
self.version, self.version,
self.sys_docker.network.dns, self.sys_docker.network.dns,

View File

@ -129,7 +129,9 @@ class DockerHomeAssistant(DockerInterface):
) )
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info("Start homeassistant %s with version %s", self.image, self.version) _LOGGER.info(
"Starting Home Assistant %s with version %s", self.image, self.version
)
def _execute_command(self, command: str) -> CommandReturn: def _execute_command(self, command: str) -> CommandReturn:
"""Create a temporary container and run command. """Create a temporary container and run command.

View File

@ -107,7 +107,7 @@ class DockerInterface(CoreSysAttributes):
""" """
image = image or self.image image = image or self.image
_LOGGER.info("Pull image %s tag %s.", image, tag) _LOGGER.info("Downloading docker image %s with tag %s.", image, tag)
try: try:
# If the image name contains a path to a registry, try to log in # If the image name contains a path to a registry, try to log in
path = IMAGE_WITH_HOST.match(image) path = IMAGE_WITH_HOST.match(image)
@ -115,7 +115,7 @@ class DockerInterface(CoreSysAttributes):
self._docker_login(path.group(1)) self._docker_login(path.group(1))
docker_image = self.sys_docker.images.pull(f"{image}:{tag}") docker_image = self.sys_docker.images.pull(f"{image}:{tag}")
if latest: if latest:
_LOGGER.info("Tag image %s with version %s as latest", image, tag) _LOGGER.info("Tagging image %s with version %s as latest", image, tag)
docker_image.tag(image, tag="latest") docker_image.tag(image, tag="latest")
except docker.errors.APIError as err: except docker.errors.APIError as err:
_LOGGER.error("Can't install %s:%s -> %s.", image, tag, err) _LOGGER.error("Can't install %s:%s -> %s.", image, tag, err)
@ -191,7 +191,7 @@ class DockerInterface(CoreSysAttributes):
# Successfull? # Successfull?
if not self._meta: if not self._meta:
raise DockerError() raise DockerError()
_LOGGER.info("Attach to %s with version %s", self.image, self.version) _LOGGER.info("Attaching to %s with version %s", self.image, self.version)
@process_lock @process_lock
def run(self) -> Awaitable[None]: def run(self) -> Awaitable[None]:
@ -223,13 +223,13 @@ class DockerInterface(CoreSysAttributes):
raise DockerError() from err raise DockerError() from err
if docker_container.status == "running": if docker_container.status == "running":
_LOGGER.info("Stop %s application", self.name) _LOGGER.info("Stopping %s application", self.name)
with suppress(docker.errors.DockerException, requests.RequestException): with suppress(docker.errors.DockerException, requests.RequestException):
docker_container.stop(timeout=self.timeout) docker_container.stop(timeout=self.timeout)
if remove_container: if remove_container:
with suppress(docker.errors.DockerException, requests.RequestException): with suppress(docker.errors.DockerException, requests.RequestException):
_LOGGER.info("Clean %s application", self.name) _LOGGER.info("Cleaning %s application", self.name)
docker_container.remove(force=True) docker_container.remove(force=True)
@process_lock @process_lock
@ -248,7 +248,7 @@ class DockerInterface(CoreSysAttributes):
_LOGGER.error("%s not found for starting up", self.name) _LOGGER.error("%s not found for starting up", self.name)
raise DockerError() from err raise DockerError() from err
_LOGGER.info("Start %s", self.name) _LOGGER.info("Starting %s", self.name)
try: try:
docker_container.start() docker_container.start()
except (docker.errors.DockerException, requests.RequestException) as err: except (docker.errors.DockerException, requests.RequestException) as err:
@ -269,7 +269,7 @@ class DockerInterface(CoreSysAttributes):
with suppress(DockerError): with suppress(DockerError):
self._stop() self._stop()
_LOGGER.info("Remove image %s with latest and %s", self.image, self.version) _LOGGER.info("Removeing image %s with latest and %s", self.image, self.version)
try: try:
with suppress(docker.errors.ImageNotFound): with suppress(docker.errors.ImageNotFound):
@ -303,7 +303,7 @@ class DockerInterface(CoreSysAttributes):
image = image or self.image image = image or self.image
_LOGGER.info( _LOGGER.info(
"Update image %s:%s to %s:%s", self.image, self.version, image, tag "Updateing image %s:%s to %s:%s", self.image, self.version, image, tag
) )
# Update docker image # Update docker image
@ -398,7 +398,7 @@ class DockerInterface(CoreSysAttributes):
except (docker.errors.DockerException, requests.RequestException) as err: except (docker.errors.DockerException, requests.RequestException) as err:
raise DockerError() from err raise DockerError() from err
_LOGGER.info("Restart %s", self.image) _LOGGER.info("Restarting %s", self.image)
try: try:
container.restart(timeout=self.timeout) container.restart(timeout=self.timeout)
except (docker.errors.DockerException, requests.RequestException) as err: except (docker.errors.DockerException, requests.RequestException) as err:

View File

@ -49,5 +49,5 @@ class DockerMulticast(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Start Multicast %s with version %s - Host", self.image, self.version "Starting Multicast %s with version %s - Host", self.image, self.version
) )

View File

@ -37,7 +37,7 @@ class DockerNetwork:
try: try:
containers.append(self.docker.containers.get(cid)) containers.append(self.docker.containers.get(cid))
except docker.errors.NotFound: except docker.errors.NotFound:
_LOGGER.warning("Docker network is corrupt! %s - run autofix", cid) _LOGGER.warning("Docker network is corrupt! %s - running autofix", cid)
self.stale_cleanup(data.get("Name", cid)) self.stale_cleanup(data.get("Name", cid))
except (docker.errors.DockerException, requests.RequestException) as err: except (docker.errors.DockerException, requests.RequestException) as err:
_LOGGER.error("Unknown error with container lookup %s", err) _LOGGER.error("Unknown error with container lookup %s", err)
@ -79,7 +79,7 @@ class DockerNetwork:
try: try:
return self.docker.networks.get(DOCKER_NETWORK) return self.docker.networks.get(DOCKER_NETWORK)
except docker.errors.NotFound: except docker.errors.NotFound:
_LOGGER.info("Can't find Supervisor network, create new network") _LOGGER.info("Can't find Supervisor network, creating a new network")
ipam_pool = docker.types.IPAMPool( ipam_pool = docker.types.IPAMPool(
subnet=str(DOCKER_NETWORK_MASK), subnet=str(DOCKER_NETWORK_MASK),

View File

@ -57,7 +57,7 @@ class DockerObserver(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Start Observer %s with version %s - %s", "Starting Observer %s with version %s - %s",
self.image, self.image,
self.version, self.version,
self.sys_docker.network.observer, self.sys_docker.network.observer,

View File

@ -44,7 +44,7 @@ class DockerSupervisor(DockerInterface, CoreSysAttributes):
self._meta = docker_container.attrs self._meta = docker_container.attrs
_LOGGER.info( _LOGGER.info(
"Attach to Supervisor %s with version %s", "Attaching to Supervisor %s with version %s",
self.image, self.image,
self.sys_supervisor.version, self.sys_supervisor.version,
) )
@ -54,7 +54,7 @@ class DockerSupervisor(DockerInterface, CoreSysAttributes):
return return
# Attach to network # Attach to network
_LOGGER.info("Connect Supervisor to hassio Network") _LOGGER.info("Connecting Supervisor to hassio-network")
self.sys_docker.network.attach_container( self.sys_docker.network.attach_container(
docker_container, docker_container,
alias=["supervisor"], alias=["supervisor"],
@ -76,7 +76,7 @@ class DockerSupervisor(DockerInterface, CoreSysAttributes):
docker_container.image.tag(self.image, tag=self.version) docker_container.image.tag(self.image, tag=self.version)
docker_container.image.tag(self.image, tag="latest") docker_container.image.tag(self.image, tag="latest")
except (docker.errors.DockerException, requests.RequestException) as err: except (docker.errors.DockerException, requests.RequestException) as err:
_LOGGER.error("Can't retag supervisor version: %s", err) _LOGGER.error("Can't retag Supervisor version: %s", err)
raise DockerError() from err raise DockerError() from err
def update_start_tag(self, image: str, version: str) -> Awaitable[None]: def update_start_tag(self, image: str, version: str) -> Awaitable[None]:

View File

@ -53,7 +53,7 @@ class HassOS(CoreSysAttributes):
def _check_host(self) -> None: def _check_host(self) -> None:
"""Check if HassOS is available.""" """Check if HassOS is available."""
if not self.available: if not self.available:
_LOGGER.error("No HassOS available") _LOGGER.error("No Home Assistant Operating System available")
raise HassOSNotSupportedError() raise HassOSNotSupportedError()
async def _download_raucb(self, version: str) -> Path: async def _download_raucb(self, version: str) -> Path:
@ -119,7 +119,9 @@ class HassOS(CoreSysAttributes):
""" """
self._check_host() self._check_host()
_LOGGER.info("Syncing configuration from USB with HassOS.") _LOGGER.info(
"Synchronizing configuration from USB with Home Assistant Operating System."
)
return self.sys_host.services.restart("hassos-config.service") return self.sys_host.services.restart("hassos-config.service")
async def update(self, version: Optional[str] = None) -> None: async def update(self, version: Optional[str] = None) -> None:
@ -149,13 +151,18 @@ class HassOS(CoreSysAttributes):
# Update success # Update success
if 0 in completed: if 0 in completed:
_LOGGER.info("Install HassOS %s success", version) _LOGGER.info(
"Install of Home Assistant Operating System %s success", version
)
self.sys_create_task(self.sys_host.control.reboot()) self.sys_create_task(self.sys_host.control.reboot())
return return
# Update failed # Update failed
await self.sys_dbus.rauc.update() await self.sys_dbus.rauc.update()
_LOGGER.error("HassOS update failed with: %s", self.sys_dbus.rauc.last_error) _LOGGER.error(
"Home Assistant Operating System update failed with: %s",
self.sys_dbus.rauc.last_error,
)
raise HassOSUpdateError() raise HassOSUpdateError()
async def mark_healthy(self) -> None: async def mark_healthy(self) -> None:

View File

@ -76,7 +76,7 @@ class HomeAssistantCore(CoreSysAttributes):
@process_lock @process_lock
async def install_landingpage(self) -> None: async def install_landingpage(self) -> None:
"""Install a landing page.""" """Install a landing page."""
_LOGGER.info("Setup HomeAssistant landingpage") _LOGGER.info("Setting up Home Assistant landingpage")
while True: while True:
if not self.sys_updater.image_homeassistant: if not self.sys_updater.image_homeassistant:
_LOGGER.warning( _LOGGER.warning(
@ -102,14 +102,14 @@ class HomeAssistantCore(CoreSysAttributes):
break break
# Start landingpage # Start landingpage
_LOGGER.info("Start HomeAssistant landingpage") _LOGGER.info("Starting HomeAssistant landingpage")
with suppress(HomeAssistantError): with suppress(HomeAssistantError):
await self._start() await self._start()
@process_lock @process_lock
async def install(self) -> None: async def install(self) -> None:
"""Install a landing page.""" """Install a landing page."""
_LOGGER.info("Setup Home Assistant") _LOGGER.info("Home Assistant setup")
while True: while True:
# read homeassistant tag and install it # read homeassistant tag and install it
if not self.sys_homeassistant.latest_version: if not self.sys_homeassistant.latest_version:
@ -127,7 +127,7 @@ class HomeAssistantCore(CoreSysAttributes):
except Exception as err: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
self.sys_capture_exception(err) self.sys_capture_exception(err)
_LOGGER.warning("Error on install Home Assistant. Retry in 30sec") _LOGGER.warning("Error on Home Assistant installation. Retry in 30sec")
await asyncio.sleep(30) await asyncio.sleep(30)
_LOGGER.info("Home Assistant docker now installed") _LOGGER.info("Home Assistant docker now installed")
@ -137,7 +137,7 @@ class HomeAssistantCore(CoreSysAttributes):
# finishing # finishing
try: try:
_LOGGER.info("Start Home Assistant") _LOGGER.info("Starting Home Assistant")
await self._start() await self._start()
except HomeAssistantError: except HomeAssistantError:
_LOGGER.error("Can't start Home Assistant!") _LOGGER.error("Can't start Home Assistant!")
@ -162,13 +162,13 @@ class HomeAssistantCore(CoreSysAttributes):
# process an update # process an update
async def _update(to_version: str) -> None: async def _update(to_version: str) -> None:
"""Run Home Assistant update.""" """Run Home Assistant update."""
_LOGGER.info("Update Home Assistant to version %s", to_version) _LOGGER.info("Updating Home Assistant to version %s", to_version)
try: try:
await self.instance.update( await self.instance.update(
to_version, image=self.sys_updater.image_homeassistant to_version, image=self.sys_updater.image_homeassistant
) )
except DockerError as err: except DockerError as err:
_LOGGER.warning("Update Home Assistant image failed") _LOGGER.warning("Updating Home Assistant image failed")
raise HomeAssistantUpdateError() from err raise HomeAssistantUpdateError() from err
else: else:
self.sys_homeassistant.version = self.instance.version self.sys_homeassistant.version = self.instance.version
@ -176,7 +176,7 @@ class HomeAssistantCore(CoreSysAttributes):
if running: if running:
await self._start() await self._start()
_LOGGER.info("Successful run Home Assistant %s", to_version) _LOGGER.info("Successful started Home Assistant %s", to_version)
# Successfull - last step # Successfull - last step
self.sys_homeassistant.save_data() self.sys_homeassistant.save_data()

View File

@ -34,7 +34,7 @@ class HomeAssistantSecrets(CoreSysAttributes):
"""Load secrets on start.""" """Load secrets on start."""
await self._read_secrets() await self._read_secrets()
_LOGGER.info("Load Home Assistant secrets: %s", len(self.secrets)) _LOGGER.info("Loaded %s Home Assistant secrets", len(self.secrets))
async def reload(self) -> None: async def reload(self) -> None:
"""Reload secrets.""" """Reload secrets."""
@ -61,4 +61,4 @@ class HomeAssistantSecrets(CoreSysAttributes):
except (YAMLError, AttributeError) as err: except (YAMLError, AttributeError) as err:
_LOGGER.error("Can't process Home Assistant secrets: %s", err) _LOGGER.error("Can't process Home Assistant secrets: %s", err)
else: else:
_LOGGER.debug("Reload Home Assistant secrets: %s", len(self.secrets)) _LOGGER.debug("Reloading Home Assistant secrets: %s", len(self.secrets))

View File

@ -103,4 +103,4 @@ class HostManager(CoreSysAttributes):
try: try:
await self.apparmor.load() await self.apparmor.load()
except HassioError as err: except HassioError as err:
_LOGGER.warning("Load host AppArmor on start failed: %s", err) _LOGGER.warning("Loading host AppArmor on start failed: %s", err)

View File

@ -52,7 +52,7 @@ class AppArmorControl(CoreSysAttributes):
self._profiles.add(content.name) self._profiles.add(content.name)
# Is connected with systemd? # Is connected with systemd?
_LOGGER.info("Load AppArmor Profiles: %s", self._profiles) _LOGGER.info("Loading AppArmor Profiles: %s", self._profiles)
for service in SYSTEMD_SERVICES: for service in SYSTEMD_SERVICES:
if not self.sys_host.services.exists(service): if not self.sys_host.services.exists(service):
continue continue
@ -67,7 +67,7 @@ class AppArmorControl(CoreSysAttributes):
async def load_profile(self, profile_name, profile_file): async def load_profile(self, profile_name, profile_file):
"""Load/Update a new/exists profile into AppArmor.""" """Load/Update a new/exists profile into AppArmor."""
if not validate_profile(profile_name, profile_file): if not validate_profile(profile_name, profile_file):
_LOGGER.error("Profile is not valid with name %s", profile_name) _LOGGER.error("AppArmor profile '%s' is not valid", profile_name)
raise HostAppArmorError() raise HostAppArmorError()
# Copy to AppArmor folder # Copy to AppArmor folder
@ -79,7 +79,7 @@ class AppArmorControl(CoreSysAttributes):
raise HostAppArmorError() from err raise HostAppArmorError() from err
# Load profiles # Load profiles
_LOGGER.info("Add or Update AppArmor profile: %s", profile_name) _LOGGER.info("Adding/updating AppArmor profile: %s", profile_name)
self._profiles.add(profile_name) self._profiles.add(profile_name)
if self.available: if self.available:
await self._reload_service() await self._reload_service()
@ -105,7 +105,7 @@ class AppArmorControl(CoreSysAttributes):
_LOGGER.error("Can't mark profile as remove: %s", err) _LOGGER.error("Can't mark profile as remove: %s", err)
raise HostAppArmorError() from err raise HostAppArmorError() from err
_LOGGER.info("Remove AppArmor profile: %s", profile_name) _LOGGER.info("Removing AppArmor profile: %s", profile_name)
self._profiles.remove(profile_name) self._profiles.remove(profile_name)
await self._reload_service() await self._reload_service()

View File

@ -89,7 +89,7 @@ class InfoCenter(CoreSysAttributes):
async def update(self): async def update(self):
"""Update properties over dbus.""" """Update properties over dbus."""
_LOGGER.info("Update local host information") _LOGGER.info("Updating local host information")
try: try:
await self.sys_dbus.hostname.update() await self.sys_dbus.hostname.update()
except DBusError: except DBusError:

View File

@ -36,7 +36,7 @@ class NetworkManager(CoreSysAttributes):
async def update(self): async def update(self):
"""Update properties over dbus.""" """Update properties over dbus."""
_LOGGER.info("Update local network information") _LOGGER.info("Updating local network information")
try: try:
await self.sys_dbus.network.update() await self.sys_dbus.network.update()
except DBusError: except DBusError:

View File

@ -26,7 +26,7 @@ class ServiceManager(CoreSysAttributes):
def _check_dbus(self, unit=None): def _check_dbus(self, unit=None):
"""Check available dbus connection.""" """Check available dbus connection."""
if not self.sys_dbus.systemd.is_connected: if not self.sys_dbus.systemd.is_connected:
_LOGGER.error("No systemd dbus connection available") _LOGGER.error("No systemd D-Bus connection available")
raise HostNotSupportedError() raise HostNotSupportedError()
if unit and not self.exists(unit): if unit and not self.exists(unit):
@ -37,28 +37,28 @@ class ServiceManager(CoreSysAttributes):
"""Start a service on host.""" """Start a service on host."""
self._check_dbus(unit) self._check_dbus(unit)
_LOGGER.info("Start local service %s", unit) _LOGGER.info("Starting local service %s", unit)
return self.sys_dbus.systemd.start_unit(unit, MOD_REPLACE) return self.sys_dbus.systemd.start_unit(unit, MOD_REPLACE)
def stop(self, unit): def stop(self, unit):
"""Stop a service on host.""" """Stop a service on host."""
self._check_dbus(unit) self._check_dbus(unit)
_LOGGER.info("Stop local service %s", unit) _LOGGER.info("Stopping local service %s", unit)
return self.sys_dbus.systemd.stop_unit(unit, MOD_REPLACE) return self.sys_dbus.systemd.stop_unit(unit, MOD_REPLACE)
def reload(self, unit): def reload(self, unit):
"""Reload a service on host.""" """Reload a service on host."""
self._check_dbus(unit) self._check_dbus(unit)
_LOGGER.info("Reload local service %s", unit) _LOGGER.info("Reloading local service %s", unit)
return self.sys_dbus.systemd.reload_unit(unit, MOD_REPLACE) return self.sys_dbus.systemd.reload_unit(unit, MOD_REPLACE)
def restart(self, unit): def restart(self, unit):
"""Restart a service on host.""" """Restart a service on host."""
self._check_dbus(unit) self._check_dbus(unit)
_LOGGER.info("Restart local service %s", unit) _LOGGER.info("Restarting local service %s", unit)
return self.sys_dbus.systemd.restart_unit(unit, MOD_REPLACE) return self.sys_dbus.systemd.restart_unit(unit, MOD_REPLACE)
def exists(self, unit): def exists(self, unit):
@ -72,7 +72,7 @@ class ServiceManager(CoreSysAttributes):
"""Update properties over dbus.""" """Update properties over dbus."""
self._check_dbus() self._check_dbus()
_LOGGER.info("Update service information") _LOGGER.info("Updating service information")
self._services.clear() self._services.clear()
try: try:
systemd_units = await self.sys_dbus.systemd.list_units() systemd_units = await self.sys_dbus.systemd.list_units()

View File

@ -220,7 +220,7 @@ class SoundControl(CoreSysAttributes):
@AsyncThrottle(timedelta(seconds=10)) @AsyncThrottle(timedelta(seconds=10))
async def update(self): async def update(self):
"""Update properties over dbus.""" """Update properties over dbus."""
_LOGGER.info("Update PulseAudio information") _LOGGER.info("Updating PulseAudio information")
def _update(): def _update():
try: try:

View File

@ -56,7 +56,7 @@ class Ingress(JsonConfig, CoreSysAttributes):
self._update_token_list() self._update_token_list()
self._cleanup_sessions() self._cleanup_sessions()
_LOGGER.info("Load %d ingress session", len(self.sessions)) _LOGGER.info("Loaded %d ingress sessions", len(self.sessions))
async def reload(self) -> None: async def reload(self) -> None:
"""Reload/Validate sessions.""" """Reload/Validate sessions."""
@ -157,7 +157,7 @@ class Ingress(JsonConfig, CoreSysAttributes):
async def update_hass_panel(self, addon: Addon): async def update_hass_panel(self, addon: Addon):
"""Return True if Home Assistant up and running.""" """Return True if Home Assistant up and running."""
if not await self.sys_homeassistant.core.is_running(): if not await self.sys_homeassistant.core.is_running():
_LOGGER.debug("Ignore panel update on Core") _LOGGER.debug("Ignoring panel update on Core")
return return
# Update UI # Update UI

View File

@ -40,7 +40,7 @@ class HwMonitor(CoreSysAttributes):
return return
self.observer.stop() self.observer.stop()
_LOGGER.info("Stop Supervisor hardware monitor") _LOGGER.info("Stopped Supervisor hardware monitor")
def _udev_events(self, action: str, device: pyudev.Device): def _udev_events(self, action: str, device: pyudev.Device):
"""Incomming events from udev. """Incomming events from udev.
@ -59,5 +59,5 @@ class HwMonitor(CoreSysAttributes):
@AsyncCallFilter(timedelta(seconds=5)) @AsyncCallFilter(timedelta(seconds=5))
def _action_sound(self, device: pyudev.Device): def _action_sound(self, device: pyudev.Device):
"""Process sound actions.""" """Process sound actions."""
_LOGGER.info("Detect changed audio hardware") _LOGGER.info("Detecting changed audio hardware")
self.sys_loop.call_later(5, self.sys_create_task, self.sys_host.sound.update()) self.sys_loop.call_later(5, self.sys_create_task, self.sys_host.sound.update())

View File

@ -99,7 +99,7 @@ class Scheduler(CoreSysAttributes):
running: List[asyncio.tasks.Task] = [] running: List[asyncio.tasks.Task] = []
# Cancel next task / get running list # Cancel next task / get running list
_LOGGER.info("Shutdown scheduled tasks") _LOGGER.info("Shutting down scheduled tasks")
for task in self._tasks: for task in self._tasks:
if task.next: if task.next:
task.next.cancel() task.next.cancel()

View File

@ -130,6 +130,7 @@ class Tasks(CoreSysAttributes):
if self.sys_host.info.free_space > MINIMUM_FREE_SPACE_THRESHOLD: if self.sys_host.info.free_space > MINIMUM_FREE_SPACE_THRESHOLD:
_LOGGER.warning("Not enough free space, pausing add-on updates") _LOGGER.warning("Not enough free space, pausing add-on updates")
_LOGGER.info("Aviable free space is %s", self.sys_host.info.free_space)
self.sys_resolution.issues = IssueType.FREE_SPACE self.sys_resolution.issues = IssueType.FREE_SPACE
return return
@ -148,15 +149,19 @@ class Tasks(CoreSysAttributes):
# don't perform an update on dev channel # don't perform an update on dev channel
if self.sys_dev: if self.sys_dev:
_LOGGER.warning("Ignore Supervisor update on dev channel!") _LOGGER.warning("Ignore Supervisor updates on dev channel!")
return return
if self.sys_host.info.free_space > MINIMUM_FREE_SPACE_THRESHOLD: if self.sys_host.info.free_space > MINIMUM_FREE_SPACE_THRESHOLD:
_LOGGER.warning("Not enough free space, pausing supervisor update") _LOGGER.warning("Not enough free space, pausing supervisor update")
_LOGGER.info("Aviable free space is %s", self.sys_host.info.free_space)
self.sys_resolution.issues = IssueType.FREE_SPACE self.sys_resolution.issues = IssueType.FREE_SPACE
return return
_LOGGER.info("Found new Supervisor version") _LOGGER.info(
"Found new Supervisor version %s, updating",
self.sys_supervisor.latest_version,
)
await self.sys_supervisor.update() await self.sys_supervisor.update()
async def _watchdog_homeassistant_docker(self): async def _watchdog_homeassistant_docker(self):
@ -180,7 +185,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_homeassistant.core.start() await self.sys_homeassistant.core.start()
except HomeAssistantError as err: except HomeAssistantError as err:
_LOGGER.error("Watchdog Home Assistant reanimation failed!") _LOGGER.error("Home Assistant watchdog reanimation failed!")
self.sys_capture_exception(err) self.sys_capture_exception(err)
async def _watchdog_homeassistant_api(self): async def _watchdog_homeassistant_api(self):
@ -218,7 +223,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_homeassistant.core.restart() await self.sys_homeassistant.core.restart()
except HomeAssistantError as err: except HomeAssistantError as err:
_LOGGER.error("Watchdog Home Assistant reanimation failed!") _LOGGER.error("Home Assistant watchdog reanimation failed!")
self.sys_capture_exception(err) self.sys_capture_exception(err)
finally: finally:
self._cache[HASS_WATCHDOG_API] = 0 self._cache[HASS_WATCHDOG_API] = 0
@ -228,7 +233,9 @@ class Tasks(CoreSysAttributes):
if not self.sys_plugins.cli.need_update: if not self.sys_plugins.cli.need_update:
return return
_LOGGER.info("Found new cli version") _LOGGER.info(
"Found new cli version %s, updating", self.sys_plugins.cli.latest_version
)
await self.sys_plugins.cli.update() await self.sys_plugins.cli.update()
async def _update_dns(self): async def _update_dns(self):
@ -236,7 +243,10 @@ class Tasks(CoreSysAttributes):
if not self.sys_plugins.dns.need_update: if not self.sys_plugins.dns.need_update:
return return
_LOGGER.info("Found new CoreDNS plugin version") _LOGGER.info(
"Found new CoreDNS plugin version %s, updating",
self.sys_plugins.dns.latest_version,
)
await self.sys_plugins.dns.update() await self.sys_plugins.dns.update()
async def _update_audio(self): async def _update_audio(self):
@ -244,7 +254,10 @@ class Tasks(CoreSysAttributes):
if not self.sys_plugins.audio.need_update: if not self.sys_plugins.audio.need_update:
return return
_LOGGER.info("Found new PulseAudio plugin version") _LOGGER.info(
"Found new PulseAudio plugin version %s, updating",
self.sys_plugins.audio.latest_version,
)
await self.sys_plugins.audio.update() await self.sys_plugins.audio.update()
async def _update_observer(self): async def _update_observer(self):
@ -252,7 +265,10 @@ class Tasks(CoreSysAttributes):
if not self.sys_plugins.observer.need_update: if not self.sys_plugins.observer.need_update:
return return
_LOGGER.info("Found new Observer plugin version") _LOGGER.info(
"Found new Observer plugin version %s, updating",
self.sys_plugins.observer.latest_version,
)
await self.sys_plugins.observer.update() await self.sys_plugins.observer.update()
async def _update_multicast(self): async def _update_multicast(self):
@ -260,7 +276,10 @@ class Tasks(CoreSysAttributes):
if not self.sys_plugins.multicast.need_update: if not self.sys_plugins.multicast.need_update:
return return
_LOGGER.info("Found new Multicast version") _LOGGER.info(
"Found new Multicast version %s, updating",
self.sys_plugins.multicast.latest_version,
)
await self.sys_plugins.multicast.update() await self.sys_plugins.multicast.update()
async def _watchdog_dns_docker(self): async def _watchdog_dns_docker(self):
@ -272,14 +291,14 @@ class Tasks(CoreSysAttributes):
# Reset of failed # Reset of failed
if await self.sys_plugins.dns.is_failed(): if await self.sys_plugins.dns.is_failed():
_LOGGER.error("CoreDNS plugin is in failed state / Reset config") _LOGGER.error("CoreDNS plugin is in failed state, resetting configuration")
await self.sys_plugins.dns.reset() await self.sys_plugins.dns.reset()
await self.sys_plugins.dns.loop_detection() await self.sys_plugins.dns.loop_detection()
try: try:
await self.sys_plugins.dns.start() await self.sys_plugins.dns.start()
except CoreDNSError: except CoreDNSError:
_LOGGER.error("Watchdog CoreDNS reanimation failed!") _LOGGER.error("CoreDNS watchdog reanimation failed!")
async def _watchdog_audio_docker(self): async def _watchdog_audio_docker(self):
"""Check running state of Docker and start if they is close.""" """Check running state of Docker and start if they is close."""
@ -294,7 +313,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_plugins.audio.start() await self.sys_plugins.audio.start()
except AudioError: except AudioError:
_LOGGER.error("Watchdog PulseAudio reanimation failed!") _LOGGER.error("PulseAudio watchdog reanimation failed!")
async def _watchdog_cli_docker(self): async def _watchdog_cli_docker(self):
"""Check running state of Docker and start if they is close.""" """Check running state of Docker and start if they is close."""
@ -306,7 +325,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_plugins.cli.start() await self.sys_plugins.cli.start()
except CliError: except CliError:
_LOGGER.error("Watchdog cli reanimation failed!") _LOGGER.error("CLI watchdog reanimation failed!")
async def _watchdog_observer_docker(self): async def _watchdog_observer_docker(self):
"""Check running state of Docker and start if they is close.""" """Check running state of Docker and start if they is close."""
@ -321,7 +340,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_plugins.observer.start() await self.sys_plugins.observer.start()
except ObserverError: except ObserverError:
_LOGGER.error("Watchdog observer reanimation failed!") _LOGGER.error("Observer watchdog reanimation failed!")
async def _watchdog_observer_application(self): async def _watchdog_observer_application(self):
"""Check running state of application and rebuild if they is not response.""" """Check running state of application and rebuild if they is not response."""
@ -336,7 +355,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_plugins.observer.rebuild() await self.sys_plugins.observer.rebuild()
except ObserverError: except ObserverError:
_LOGGER.error("Watchdog observer reanimation failed!") _LOGGER.error("Observer watchdog reanimation failed!")
async def _watchdog_multicast_docker(self): async def _watchdog_multicast_docker(self):
"""Check running state of Docker and start if they is close.""" """Check running state of Docker and start if they is close."""
@ -351,7 +370,7 @@ class Tasks(CoreSysAttributes):
try: try:
await self.sys_plugins.multicast.start() await self.sys_plugins.multicast.start()
except MulticastError: except MulticastError:
_LOGGER.error("Watchdog Multicast reanimation failed!") _LOGGER.error("Multicast watchdog reanimation failed!")
async def _watchdog_addon_docker(self): async def _watchdog_addon_docker(self):
"""Check running state of Docker and start if they is close.""" """Check running state of Docker and start if they is close."""
@ -368,7 +387,7 @@ class Tasks(CoreSysAttributes):
try: try:
await addon.start() await addon.start()
except AddonsError as err: except AddonsError as err:
_LOGGER.error("Watchdog %s reanimation failed with %s", addon.slug, err) _LOGGER.error("%s watchdog reanimation failed with %s", addon.slug, err)
self.sys_capture_exception(err) self.sys_capture_exception(err)
async def _watchdog_addon_application(self): async def _watchdog_addon_application(self):
@ -398,7 +417,7 @@ class Tasks(CoreSysAttributes):
try: try:
await addon.restart() await addon.restart()
except AddonsError as err: except AddonsError as err:
_LOGGER.error("Watchdog %s reanimation failed with %s", addon.slug, err) _LOGGER.error("%s watchdog reanimation failed with %s", addon.slug, err)
self.sys_capture_exception(err) self.sys_capture_exception(err)
finally: finally:
self._cache[addon.slug] = 0 self._cache[addon.slug] = 0

View File

@ -89,12 +89,12 @@ class PluginManager(CoreSysAttributes):
continue continue
except TypeError: except TypeError:
_LOGGER.warning( _LOGGER.warning(
"Somethings going wrong with requirements on %s", "Unexpected issue while checking requirements for %s",
type(plugin).__name__, type(plugin).__name__,
) )
_LOGGER.info( _LOGGER.info(
"Requirement need update for %s - %s", "%s does not have the required version %s, updating",
type(plugin).__name__, type(plugin).__name__,
required_version, required_version,
) )
@ -102,7 +102,7 @@ class PluginManager(CoreSysAttributes):
await plugin.update(version=str(required_version)) await plugin.update(version=str(required_version))
except HassioError: except HassioError:
_LOGGER.error( _LOGGER.error(
"Can't update %s to %s but it's a reuirement, the Supervisor is not health now!", "Can't update %s to %s but it's a reuirement, the Supervisor is now in an unhealthy state!",
type(plugin).__name__, type(plugin).__name__,
required_version, required_version,
) )

View File

@ -136,7 +136,7 @@ class Audio(JsonConfig, CoreSysAttributes):
self.latest_version, image=self.sys_updater.image_audio self.latest_version, image=self.sys_updater.image_audio
) )
break break
_LOGGER.warning("Error on install Audio plugin. Retry in 30sec") _LOGGER.warning("Error on installing Audio plugin, retrying in 30sec")
await asyncio.sleep(30) await asyncio.sleep(30)
_LOGGER.info("Audio plugin now installed") _LOGGER.info("Audio plugin now installed")
@ -172,7 +172,7 @@ class Audio(JsonConfig, CoreSysAttributes):
async def restart(self) -> None: async def restart(self) -> None:
"""Restart Audio plugin.""" """Restart Audio plugin."""
_LOGGER.info("Restart Audio plugin") _LOGGER.info("Restarting Audio plugin")
try: try:
await self.instance.restart() await self.instance.restart()
except DockerError as err: except DockerError as err:
@ -181,7 +181,7 @@ class Audio(JsonConfig, CoreSysAttributes):
async def start(self) -> None: async def start(self) -> None:
"""Run CoreDNS.""" """Run CoreDNS."""
_LOGGER.info("Start Audio plugin") _LOGGER.info("Starting Audio plugin")
try: try:
await self.instance.run() await self.instance.run()
except DockerError as err: except DockerError as err:
@ -190,7 +190,7 @@ class Audio(JsonConfig, CoreSysAttributes):
async def stop(self) -> None: async def stop(self) -> None:
"""Stop CoreDNS.""" """Stop CoreDNS."""
_LOGGER.info("Stop Audio plugin") _LOGGER.info("Stopping Audio plugin")
try: try:
await self.instance.stop() await self.instance.stop()
except DockerError as err: except DockerError as err:
@ -223,11 +223,11 @@ class Audio(JsonConfig, CoreSysAttributes):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair Audio %s", self.version) _LOGGER.info("Repairing Audio %s", self.version)
try: try:
await self.instance.install(self.version) await self.instance.install(self.version)
except DockerError as err: except DockerError as err:
_LOGGER.error("Repairing of Audio failed") _LOGGER.error("Repair of Audio failed")
self.sys_capture_exception(err) self.sys_capture_exception(err)
def pulse_client(self, input_profile=None, output_profile=None) -> str: def pulse_client(self, input_profile=None, output_profile=None) -> str:

View File

@ -98,7 +98,7 @@ class HaCli(CoreSysAttributes, JsonConfig):
async def install(self) -> None: async def install(self) -> None:
"""Install cli.""" """Install cli."""
_LOGGER.info("Setup cli plugin") _LOGGER.info("Running setup for CLI plugin")
while True: while True:
# read audio tag and install it # read audio tag and install it
if not self.latest_version: if not self.latest_version:
@ -114,7 +114,7 @@ class HaCli(CoreSysAttributes, JsonConfig):
_LOGGER.warning("Error on install cli plugin. Retry in 30sec") _LOGGER.warning("Error on install cli plugin. Retry in 30sec")
await asyncio.sleep(30) await asyncio.sleep(30)
_LOGGER.info("cli plugin now installed") _LOGGER.info("CLI plugin is now installed")
self.version = self.instance.version self.version = self.instance.version
self.image = self.sys_updater.image_cli self.image = self.sys_updater.image_cli
self.save_data() self.save_data()
@ -125,13 +125,13 @@ class HaCli(CoreSysAttributes, JsonConfig):
old_image = self.image old_image = self.image
if version == self.version: if version == self.version:
_LOGGER.warning("Version %s is already installed for cli", version) _LOGGER.warning("Version %s is already installed for CLI", version)
return return
try: try:
await self.instance.update(version, image=self.sys_updater.image_cli) await self.instance.update(version, image=self.sys_updater.image_cli)
except DockerError as err: except DockerError as err:
_LOGGER.error("HA cli update failed") _LOGGER.error("CLI update failed")
raise CliUpdateError() from err raise CliUpdateError() from err
else: else:
self.version = version self.version = version
@ -152,7 +152,7 @@ class HaCli(CoreSysAttributes, JsonConfig):
self.save_data() self.save_data()
# Start Instance # Start Instance
_LOGGER.info("Start cli plugin") _LOGGER.info("Starting CLI plugin")
try: try:
await self.instance.run() await self.instance.run()
except DockerError as err: except DockerError as err:
@ -161,7 +161,7 @@ class HaCli(CoreSysAttributes, JsonConfig):
async def stop(self) -> None: async def stop(self) -> None:
"""Stop cli.""" """Stop cli."""
_LOGGER.info("Stop cli plugin") _LOGGER.info("Stopping cli plugin")
try: try:
await self.instance.stop() await self.instance.stop()
except DockerError as err: except DockerError as err:
@ -187,9 +187,9 @@ class HaCli(CoreSysAttributes, JsonConfig):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair HA cli %s", self.version) _LOGGER.info("Repairing HA cli %s", self.version)
try: try:
await self.instance.install(self.version) await self.instance.install(self.version)
except DockerError as err: except DockerError as err:
_LOGGER.error("Repairing of HA cli failed") _LOGGER.error("Repair of HA cli failed")
self.sys_capture_exception(err) self.sys_capture_exception(err)

View File

@ -155,7 +155,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
async def install(self) -> None: async def install(self) -> None:
"""Install CoreDNS.""" """Install CoreDNS."""
_LOGGER.info("Setup CoreDNS plugin") _LOGGER.info("Running setup for CoreDNS plugin")
while True: while True:
# read homeassistant tag and install it # read homeassistant tag and install it
if not self.latest_version: if not self.latest_version:
@ -208,7 +208,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
async def restart(self) -> None: async def restart(self) -> None:
"""Restart CoreDNS plugin.""" """Restart CoreDNS plugin."""
self._write_corefile() self._write_corefile()
_LOGGER.info("Restart CoreDNS plugin") _LOGGER.info("Restarting CoreDNS plugin")
try: try:
await self.instance.restart() await self.instance.restart()
except DockerError as err: except DockerError as err:
@ -220,7 +220,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
self._write_corefile() self._write_corefile()
# Start Instance # Start Instance
_LOGGER.info("Start CoreDNS plugin") _LOGGER.info("Starting CoreDNS plugin")
try: try:
await self.instance.run() await self.instance.run()
except DockerError as err: except DockerError as err:
@ -229,7 +229,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
async def stop(self) -> None: async def stop(self) -> None:
"""Stop CoreDNS.""" """Stop CoreDNS."""
_LOGGER.info("Stop CoreDNS plugin") _LOGGER.info("Stopping CoreDNS plugin")
try: try:
await self.instance.stop() await self.instance.stop()
except DockerError as err: except DockerError as err:
@ -258,7 +258,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
# Check the log for loop plugin output # Check the log for loop plugin output
if b"plugin/loop: Loop" in log: if b"plugin/loop: Loop" in log:
_LOGGER.error("Detect a DNS loop in local Network!") _LOGGER.error("Detected a DNS loop in local Network!")
self._loop = True self._loop = True
else: else:
self._loop = False self._loop = False
@ -274,7 +274,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
local_dns = self.sys_host.network.dns_servers or ["dns://127.0.0.11"] local_dns = self.sys_host.network.dns_servers or ["dns://127.0.0.11"]
servers = self.servers + local_dns servers = self.servers + local_dns
else: else:
_LOGGER.warning("Ignore user DNS settings because of loop") _LOGGER.warning("Ignoring user DNS settings because of loop")
# Print some usefully debug data # Print some usefully debug data
_LOGGER.debug( _LOGGER.debug(
@ -290,7 +290,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
if server not in dns_servers: if server not in dns_servers:
dns_servers.append(server) dns_servers.append(server)
except vol.Invalid: except vol.Invalid:
_LOGGER.warning("Ignore invalid DNS Server: %s", server) _LOGGER.warning("Ignoring invalid DNS Server: %s", server)
# Generate config file # Generate config file
data = self.coredns_template.render( data = self.coredns_template.render(
@ -362,7 +362,7 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
_LOGGER.debug("Can't remove Host entry: %s", host) _LOGGER.debug("Can't remove Host entry: %s", host)
return return
_LOGGER.debug("Remove Host entry %s - %s", entry.ip_address, entry.names) _LOGGER.debug("Removeing host entry %s - %s", entry.ip_address, entry.names)
self._hosts.remove(entry) self._hosts.remove(entry)
# Update hosts file # Update hosts file
@ -411,11 +411,11 @@ class CoreDNS(JsonConfig, CoreSysAttributes):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair CoreDNS %s", self.version) _LOGGER.info("Repairing CoreDNS %s", self.version)
try: try:
await self.instance.install(self.version) await self.instance.install(self.version)
except DockerError as err: except DockerError as err:
_LOGGER.error("Repairing of CoreDNS failed") _LOGGER.error("Repair of CoreDNS failed")
self.sys_capture_exception(err) self.sys_capture_exception(err)
def _write_resolv(self, resolv_conf: Path) -> None: def _write_resolv(self, resolv_conf: Path) -> None:

View File

@ -96,7 +96,7 @@ class Multicast(JsonConfig, CoreSysAttributes):
async def install(self) -> None: async def install(self) -> None:
"""Install Multicast.""" """Install Multicast."""
_LOGGER.info("Setup Multicast plugin") _LOGGER.info("Running setup for Multicast plugin")
while True: while True:
# read homeassistant tag and install it # read homeassistant tag and install it
if not self.latest_version: if not self.latest_version:
@ -111,7 +111,7 @@ class Multicast(JsonConfig, CoreSysAttributes):
_LOGGER.warning("Error on install Multicast plugin. Retry in 30sec") _LOGGER.warning("Error on install Multicast plugin. Retry in 30sec")
await asyncio.sleep(30) await asyncio.sleep(30)
_LOGGER.info("Multicast plugin now installed") _LOGGER.info("Multicast plugin is now installed")
self.version = self.instance.version self.version = self.instance.version
self.image = self.sys_updater.image_multicast self.image = self.sys_updater.image_multicast
self.save_data() self.save_data()
@ -145,7 +145,7 @@ class Multicast(JsonConfig, CoreSysAttributes):
async def restart(self) -> None: async def restart(self) -> None:
"""Restart Multicast plugin.""" """Restart Multicast plugin."""
_LOGGER.info("Restart Multicast plugin") _LOGGER.info("Restarting Multicast plugin")
try: try:
await self.instance.restart() await self.instance.restart()
except DockerError as err: except DockerError as err:
@ -154,7 +154,7 @@ class Multicast(JsonConfig, CoreSysAttributes):
async def start(self) -> None: async def start(self) -> None:
"""Run Multicast.""" """Run Multicast."""
_LOGGER.info("Start Multicast plugin") _LOGGER.info("Starting Multicast plugin")
try: try:
await self.instance.run() await self.instance.run()
except DockerError as err: except DockerError as err:
@ -163,7 +163,7 @@ class Multicast(JsonConfig, CoreSysAttributes):
async def stop(self) -> None: async def stop(self) -> None:
"""Stop Multicast.""" """Stop Multicast."""
_LOGGER.info("Stop Multicast plugin") _LOGGER.info("Stopping Multicast plugin")
try: try:
await self.instance.stop() await self.instance.stop()
except DockerError as err: except DockerError as err:
@ -203,9 +203,9 @@ class Multicast(JsonConfig, CoreSysAttributes):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair Multicast %s", self.version) _LOGGER.info("Repairing Multicast %s", self.version)
try: try:
await self.instance.install(self.version) await self.instance.install(self.version)
except DockerError as err: except DockerError as err:
_LOGGER.error("Repairing of Multicast failed") _LOGGER.error("Repair of Multicast failed")
self.sys_capture_exception(err) self.sys_capture_exception(err)

View File

@ -102,7 +102,7 @@ class Observer(CoreSysAttributes, JsonConfig):
async def install(self) -> None: async def install(self) -> None:
"""Install observer.""" """Install observer."""
_LOGGER.info("Setup observer plugin") _LOGGER.info("Running setup for observer plugin")
while True: while True:
# read observer tag and install it # read observer tag and install it
if not self.latest_version: if not self.latest_version:
@ -156,7 +156,7 @@ class Observer(CoreSysAttributes, JsonConfig):
self.save_data() self.save_data()
# Start Instance # Start Instance
_LOGGER.info("Start observer plugin") _LOGGER.info("Starting observer plugin")
try: try:
await self.instance.run() await self.instance.run()
except DockerError as err: except DockerError as err:
@ -202,9 +202,9 @@ class Observer(CoreSysAttributes, JsonConfig):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair HA observer %s", self.version) _LOGGER.info("Repairing HA observer %s", self.version)
try: try:
await self.instance.install(self.version) await self.instance.install(self.version)
except DockerError as err: except DockerError as err:
_LOGGER.error("Repairing of HA observer failed") _LOGGER.error("Repair of HA observer failed")
self.sys_capture_exception(err) self.sys_capture_exception(err)

View File

@ -70,7 +70,9 @@ class MQTTService(ServiceInterface):
def set_service_data(self, addon: Addon, data: Dict[str, Any]) -> None: def set_service_data(self, addon: Addon, data: Dict[str, Any]) -> None:
"""Write the data into service object.""" """Write the data into service object."""
if self.enabled: if self.enabled:
_LOGGER.error("It is already a MQTT in use from %s", self._data[ATTR_ADDON]) _LOGGER.error(
"There is already a MQTT service in use from %s", self._data[ATTR_ADDON]
)
raise ServicesError() raise ServicesError()
self._data.update(data) self._data.update(data)

View File

@ -65,7 +65,8 @@ class MySQLService(ServiceInterface):
"""Write the data into service object.""" """Write the data into service object."""
if self.enabled: if self.enabled:
_LOGGER.error( _LOGGER.error(
"There is already a MySQL in use from %s", self._data[ATTR_ADDON] "There is already a MySQL service in use from %s",
self._data[ATTR_ADDON],
) )
raise ServicesError() raise ServicesError()

View File

@ -114,7 +114,7 @@ class SnapshotManager(CoreSysAttributes):
snapshot = Snapshot(self.coresys, tar_origin) snapshot = Snapshot(self.coresys, tar_origin)
if not await snapshot.load(): if not await snapshot.load():
return None return None
_LOGGER.info("Success import %s", snapshot.slug) _LOGGER.info("Successfully imported %s", snapshot.slug)
self.snapshots_obj[snapshot.slug] = snapshot self.snapshots_obj[snapshot.slug] = snapshot
return snapshot return snapshot
@ -126,18 +126,18 @@ class SnapshotManager(CoreSysAttributes):
return None return None
snapshot = self._create_snapshot(name, SNAPSHOT_FULL, password) snapshot = self._create_snapshot(name, SNAPSHOT_FULL, password)
_LOGGER.info("Full-Snapshot %s start", snapshot.slug) _LOGGER.info("Creating new full-snapshot with slug %s", snapshot.slug)
try: try:
self.sys_core.state = CoreState.FREEZE self.sys_core.state = CoreState.FREEZE
await self.lock.acquire() await self.lock.acquire()
async with snapshot: async with snapshot:
# Snapshot add-ons # Snapshot add-ons
_LOGGER.info("Snapshot %s store Add-ons", snapshot.slug) _LOGGER.info("Snapshotting %s store Add-ons", snapshot.slug)
await snapshot.store_addons() await snapshot.store_addons()
# Snapshot folders # Snapshot folders
_LOGGER.info("Snapshot %s store folders", snapshot.slug) _LOGGER.info("Snapshotting %s store folders", snapshot.slug)
await snapshot.store_folders() await snapshot.store_folders()
except Exception as excep: # pylint: disable=broad-except except Exception as excep: # pylint: disable=broad-except
@ -146,7 +146,7 @@ class SnapshotManager(CoreSysAttributes):
return None return None
else: else:
_LOGGER.info("Full-Snapshot %s done", snapshot.slug) _LOGGER.info("Crating full-snapshot with slug %s completed", snapshot.slug)
self.snapshots_obj[snapshot.slug] = snapshot self.snapshots_obj[snapshot.slug] = snapshot
return snapshot return snapshot
@ -166,7 +166,7 @@ class SnapshotManager(CoreSysAttributes):
folders = folders or [] folders = folders or []
snapshot = self._create_snapshot(name, SNAPSHOT_PARTIAL, password) snapshot = self._create_snapshot(name, SNAPSHOT_PARTIAL, password)
_LOGGER.info("Partial-Snapshot %s start", snapshot.slug) _LOGGER.info("Creating new partial-snapshot with slug %s", snapshot.slug)
try: try:
self.sys_core.state = CoreState.FREEZE self.sys_core.state = CoreState.FREEZE
await self.lock.acquire() await self.lock.acquire()
@ -182,12 +182,12 @@ class SnapshotManager(CoreSysAttributes):
_LOGGER.warning("Add-on %s not found/installed", addon_slug) _LOGGER.warning("Add-on %s not found/installed", addon_slug)
if addon_list: if addon_list:
_LOGGER.info("Snapshot %s store Add-ons", snapshot.slug) _LOGGER.info("Snapshotting %s store Add-ons", snapshot.slug)
await snapshot.store_addons(addon_list) await snapshot.store_addons(addon_list)
# Snapshot folders # Snapshot folders
if folders: if folders:
_LOGGER.info("Snapshot %s store folders", snapshot.slug) _LOGGER.info("Snapshotting %s store folders", snapshot.slug)
await snapshot.store_folders(folders) await snapshot.store_folders(folders)
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
@ -195,7 +195,9 @@ class SnapshotManager(CoreSysAttributes):
return None return None
else: else:
_LOGGER.info("Partial-Snapshot %s done", snapshot.slug) _LOGGER.info(
"Crating partial-snapshot with slug %s completed", snapshot.slug
)
self.snapshots_obj[snapshot.slug] = snapshot self.snapshots_obj[snapshot.slug] = snapshot
return snapshot return snapshot
@ -210,7 +212,7 @@ class SnapshotManager(CoreSysAttributes):
return False return False
if snapshot.sys_type != SNAPSHOT_FULL: if snapshot.sys_type != SNAPSHOT_FULL:
_LOGGER.error("Restore %s is only a partial snapshot!", snapshot.slug) _LOGGER.error("%s is only a partial snapshot!", snapshot.slug)
return False return False
if snapshot.protected and not snapshot.set_password(password): if snapshot.protected and not snapshot.set_password(password):
@ -227,26 +229,26 @@ class SnapshotManager(CoreSysAttributes):
await self.sys_core.shutdown() await self.sys_core.shutdown()
# Restore folders # Restore folders
_LOGGER.info("Restore %s run folders", snapshot.slug) _LOGGER.info("Restoring %s folders", snapshot.slug)
await snapshot.restore_folders() await snapshot.restore_folders()
# Restore docker config # Restore docker config
_LOGGER.info("Restore %s run Docker Config", snapshot.slug) _LOGGER.info("Restoring %s Docker Config", snapshot.slug)
snapshot.restore_dockerconfig() snapshot.restore_dockerconfig()
# Start homeassistant restore # Start homeassistant restore
_LOGGER.info("Restore %s run Home-Assistant", snapshot.slug) _LOGGER.info("Restoring %s Home-Assistant", snapshot.slug)
snapshot.restore_homeassistant() snapshot.restore_homeassistant()
task_hass = self.sys_create_task( task_hass = self.sys_create_task(
self.sys_homeassistant.core.update(snapshot.homeassistant_version) self.sys_homeassistant.core.update(snapshot.homeassistant_version)
) )
# Restore repositories # Restore repositories
_LOGGER.info("Restore %s run Repositories", snapshot.slug) _LOGGER.info("Restoring %s Repositories", snapshot.slug)
await snapshot.restore_repositories() await snapshot.restore_repositories()
# Delete delta add-ons # Delete delta add-ons
_LOGGER.info("Restore %s remove add-ons", snapshot.slug) _LOGGER.info("Removing add-ons not in the snapshot %s", snapshot.slug)
for addon in self.sys_addons.installed: for addon in self.sys_addons.installed:
if addon.slug in snapshot.addon_list: if addon.slug in snapshot.addon_list:
continue continue
@ -301,7 +303,7 @@ class SnapshotManager(CoreSysAttributes):
async with snapshot: async with snapshot:
# Restore docker config # Restore docker config
_LOGGER.info("Restore %s run Docker Config", snapshot.slug) _LOGGER.info("Restoring %s Docker Config", snapshot.slug)
snapshot.restore_dockerconfig() snapshot.restore_dockerconfig()
# Stop Home-Assistant for config restore # Stop Home-Assistant for config restore
@ -311,13 +313,13 @@ class SnapshotManager(CoreSysAttributes):
# Process folders # Process folders
if folders: if folders:
_LOGGER.info("Restore %s run folders", snapshot.slug) _LOGGER.info("Restoring %s folders", snapshot.slug)
await snapshot.restore_folders(folders) await snapshot.restore_folders(folders)
# Process Home-Assistant # Process Home-Assistant
task_hass = None task_hass = None
if homeassistant: if homeassistant:
_LOGGER.info("Restore %s run Home-Assistant", snapshot.slug) _LOGGER.info("Restoring %s Home-Assistant", snapshot.slug)
task_hass = self.sys_create_task( task_hass = self.sys_create_task(
self.sys_homeassistant.core.update( self.sys_homeassistant.core.update(
snapshot.homeassistant_version snapshot.homeassistant_version
@ -325,10 +327,10 @@ class SnapshotManager(CoreSysAttributes):
) )
if addons: if addons:
_LOGGER.info("Restore %s run Repositories", snapshot.slug) _LOGGER.info("Restoring %s Repositories", snapshot.slug)
await snapshot.restore_repositories() await snapshot.restore_repositories()
_LOGGER.info("Restore %s old add-ons", snapshot.slug) _LOGGER.info("Restoring %s old add-ons", snapshot.slug)
await snapshot.restore_addons(addons) await snapshot.restore_addons(addons)
# Make sure homeassistant run agen # Make sure homeassistant run agen

View File

@ -225,7 +225,7 @@ class Snapshot(CoreSysAttributes):
async def load(self): async def load(self):
"""Read snapshot.json from tar file.""" """Read snapshot.json from tar file."""
if not self.tarfile.is_file(): if not self.tarfile.is_file():
_LOGGER.error("No tarfile %s", self.tarfile) _LOGGER.error("No tarfile located at %s", self.tarfile)
return False return False
def _load_file(): def _load_file():
@ -321,7 +321,7 @@ class Snapshot(CoreSysAttributes):
try: try:
await addon.snapshot(addon_file) await addon.snapshot(addon_file)
except AddonsError: except AddonsError:
_LOGGER.error("Can't make snapshot from %s", addon.slug) _LOGGER.error("Can't create snapshot for %s", addon.slug)
return return
# Store to config # Store to config
@ -354,14 +354,14 @@ class Snapshot(CoreSysAttributes):
# If exists inside snapshot # If exists inside snapshot
if not addon_file.path.exists(): if not addon_file.path.exists():
_LOGGER.error("Can't find snapshot for %s", addon_slug) _LOGGER.error("Can't find snapshot %s", addon_slug)
return return
# Perform a restore # Perform a restore
try: try:
await self.sys_addons.restore(addon_slug, addon_file) await self.sys_addons.restore(addon_slug, addon_file)
except AddonsError: except AddonsError:
_LOGGER.error("Can't restore snapshot for %s", addon_slug) _LOGGER.error("Can't restore snapshot %s", addon_slug)
# Save Add-ons sequential # Save Add-ons sequential
# avoid issue on slow IO # avoid issue on slow IO

View File

@ -65,7 +65,7 @@ class StoreManager(CoreSysAttributes):
"""Add a repository.""" """Add a repository."""
repository = Repository(self.coresys, url) repository = Repository(self.coresys, url)
if not await repository.load(): if not await repository.load():
_LOGGER.error("Can't load from repository %s", url) _LOGGER.error("Can't load data from repository %s", url)
return return
# don't add built-in repository to config # don't add built-in repository to config
@ -107,7 +107,7 @@ class StoreManager(CoreSysAttributes):
del_addons = set(self.sys_addons.store) - all_addons del_addons = set(self.sys_addons.store) - all_addons
_LOGGER.info( _LOGGER.info(
"Load add-ons from store: %d all - %d new - %d remove", "Loading add-ons from store: %d all - %d new - %d remove",
len(all_addons), len(all_addons),
len(add_addons), len(add_addons),
len(del_addons), len(del_addons),

View File

@ -44,7 +44,7 @@ class GitRepo(CoreSysAttributes):
async with self.lock: async with self.lock:
try: try:
_LOGGER.info("Load add-on %s repository", self.path) _LOGGER.info("Loading add-on %s repository", self.path)
self.repo = await self.sys_run_in_executor(git.Repo, str(self.path)) self.repo = await self.sys_run_in_executor(git.Repo, str(self.path))
except ( except (
@ -73,7 +73,7 @@ class GitRepo(CoreSysAttributes):
} }
try: try:
_LOGGER.info("Clone add-on %s repository", self.url) _LOGGER.info("Cloneing add-on %s repository", self.url)
self.repo = await self.sys_run_in_executor( self.repo = await self.sys_run_in_executor(
ft.partial( ft.partial(
git.Repo.clone_from, self.url, str(self.path), **git_args git.Repo.clone_from, self.url, str(self.path), **git_args
@ -165,5 +165,5 @@ class GitRepoCustom(GitRepo):
async def remove(self): async def remove(self):
"""Remove a custom repository.""" """Remove a custom repository."""
_LOGGER.info("Remove custom add-on repository %s", self.url) _LOGGER.info("Removing custom add-on repository %s", self.url)
await self._remove() await self._remove()

View File

@ -75,7 +75,7 @@ class Supervisor(CoreSysAttributes):
"""Fetch last version and update profile.""" """Fetch last version and update profile."""
url = URL_HASSIO_APPARMOR url = URL_HASSIO_APPARMOR
try: try:
_LOGGER.info("Fetch AppArmor profile %s", url) _LOGGER.info("Fetching AppArmor profile %s", url)
async with self.sys_websession.get(url, timeout=10) as request: async with self.sys_websession.get(url, timeout=10) as request:
data = await request.text() data = await request.text()
@ -150,8 +150,8 @@ class Supervisor(CoreSysAttributes):
if await self.instance.exists(): if await self.instance.exists():
return return
_LOGGER.info("Repair Supervisor %s", self.version) _LOGGER.info("Repairing Supervisor %s", self.version)
try: try:
await self.instance.retag() await self.instance.retag()
except DockerError: except DockerError:
_LOGGER.error("Repairing of Supervisor failed") _LOGGER.error("Repair of Supervisor failed")

View File

@ -167,7 +167,7 @@ class Updater(JsonConfig, CoreSysAttributes):
machine = self.sys_machine or "default" machine = self.sys_machine or "default"
try: try:
_LOGGER.info("Fetch update data from %s", url) _LOGGER.info("Fetching update data from %s", url)
async with self.sys_websession.get(url, timeout=10) as request: async with self.sys_websession.get(url, timeout=10) as request:
data = await request.json(content_type=None) data = await request.json(content_type=None)

View File

@ -96,7 +96,7 @@ class DBus:
# pylint: disable=protected-access # pylint: disable=protected-access
await self._init_proxy() await self._init_proxy()
_LOGGER.debug("Connect to dbus: %s - %s", bus_name, object_path) _LOGGER.debug("Connect to D-Bus: %s - %s", bus_name, object_path)
return self return self
async def _init_proxy(self) -> None: async def _init_proxy(self) -> None:
@ -222,7 +222,7 @@ class DBus:
async def _send(self, command: List[str], silent=False) -> str: async def _send(self, command: List[str], silent=False) -> str:
"""Send command over dbus.""" """Send command over dbus."""
# Run command # Run command
_LOGGER.debug("Send dbus command: %s", command) _LOGGER.debug("Send D-Bus command: %s", command)
try: try:
proc = await asyncio.create_subprocess_exec( proc = await asyncio.create_subprocess_exec(
*command, *command,
@ -233,7 +233,7 @@ class DBus:
data, error = await proc.communicate() data, error = await proc.communicate()
except OSError as err: except OSError as err:
_LOGGER.error("DBus fatal error: %s", err) _LOGGER.critical("D-Bus fatal error: %s", err)
raise DBusFatalError() from err raise DBusFatalError() from err
# Success? # Success?
@ -248,7 +248,7 @@ class DBus:
raise exception() raise exception()
# General # General
_LOGGER.error("DBus return: %s", error.strip()) _LOGGER.error("D-Bus return: %s", error.strip())
raise DBusFatalError() raise DBusFatalError()
def attach_signals(self, filters=None): def attach_signals(self, filters=None):
@ -277,7 +277,7 @@ class DBusCallWrapper:
def __call__(self) -> None: def __call__(self) -> None:
"""Catch this method from being called.""" """Catch this method from being called."""
_LOGGER.error("DBus method %s not exists!", self.interface) _LOGGER.error("D-Bus method %s not exists!", self.interface)
raise DBusFatalError() raise DBusFatalError()
def __getattr__(self, name: str): def __getattr__(self, name: str):
@ -308,7 +308,7 @@ class DBusSignalWrapper:
async def __aenter__(self): async def __aenter__(self):
"""Start monitor events.""" """Start monitor events."""
_LOGGER.info("Start dbus monitor on %s", self.dbus.bus_name) _LOGGER.info("Starting dbus monitor on %s", self.dbus.bus_name)
command = shlex.split(MONITOR.format(bus=self.dbus.bus_name)) command = shlex.split(MONITOR.format(bus=self.dbus.bus_name))
self._proc = await asyncio.create_subprocess_exec( self._proc = await asyncio.create_subprocess_exec(
*command, *command,
@ -321,7 +321,7 @@ class DBusSignalWrapper:
async def __aexit__(self, exception_type, exception_value, traceback): async def __aexit__(self, exception_type, exception_value, traceback):
"""Stop monitor events.""" """Stop monitor events."""
_LOGGER.info("Stop dbus monitor on %s", self.dbus.bus_name) _LOGGER.info("Stopping dbus monitor on %s", self.dbus.bus_name)
self._proc.send_signal(SIGINT) self._proc.send_signal(SIGINT)
await self._proc.communicate() await self._proc.communicate()
@ -354,7 +354,7 @@ class DBusSignalWrapper:
# Filter signals? # Filter signals?
if self._signals and signal not in self._signals: if self._signals and signal not in self._signals:
_LOGGER.debug("Skip event %s - %s", signal, data) _LOGGER.debug("Skiping event %s - %s", signal, data)
continue continue
try: try:

View File

@ -70,7 +70,7 @@ class JsonConfig:
) )
# Reset data to default # Reset data to default
_LOGGER.warning("Reset %s to default", self._file) _LOGGER.warning("Resetting %s to default", self._file)
self._data = self._schema(_DEFAULT) self._data = self._schema(_DEFAULT)
def save_data(self) -> None: def save_data(self) -> None:
@ -82,7 +82,7 @@ class JsonConfig:
_LOGGER.error("Can't parse data: %s", humanize_error(self._data, ex)) _LOGGER.error("Can't parse data: %s", humanize_error(self._data, ex))
# Load last valid data # Load last valid data
_LOGGER.warning("Reset %s to last version", self._file) _LOGGER.warning("Resetting %s to last version", self._file)
self._data = _DEFAULT self._data = _DEFAULT
self.read_data() self.read_data()
else: else:

View File

@ -18,7 +18,7 @@ def format_message(message: str) -> str:
if match: if match:
return f"Port '{match.group(1)}' is already in use by something else on the host." return f"Port '{match.group(1)}' is already in use by something else on the host."
except TypeError as err: except TypeError as err:
_LOGGER.error("Type of message is not string - %s", err) _LOGGER.error("The type of message is not a string - %s", err)
sentry_sdk.capture_exception(err) sentry_sdk.capture_exception(err)
return message return message

View File

@ -136,7 +136,7 @@ def secure_path(tar: tarfile.TarFile) -> Generator[tarfile.TarInfo, None, None]:
raise ValueError() raise ValueError()
Path("/fake", file_path).resolve().relative_to("/fake") Path("/fake", file_path).resolve().relative_to("/fake")
except (ValueError, RuntimeError): except (ValueError, RuntimeError):
_LOGGER.warning("Issue with file %s", file_path) _LOGGER.warning("Found issue with file %s", file_path)
continue continue
else: else:
yield member yield member
@ -148,7 +148,7 @@ def _is_excluded_by_filter(path: PurePath, exclude_list: List[str]) -> bool:
for exclude in exclude_list: for exclude in exclude_list:
if not path.match(exclude): if not path.match(exclude):
continue continue
_LOGGER.debug("Ignore %s because of %s", path, exclude) _LOGGER.debug("Ignoring %s because of %s", path, exclude)
return True return True
return False return False