mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-16 13:46:31 +00:00
Set agent diagnostics (#3203)
* Set agent diagnostics * Add AttributeError to dbus_property wrapper * Use dbus_property instead of dbus_connected * Move sync to core setup
This commit is contained in:
parent
8a553dbb59
commit
6ab4dda5e8
@ -142,6 +142,7 @@ class APISupervisor(CoreSysAttributes):
|
|||||||
|
|
||||||
if ATTR_DIAGNOSTICS in body:
|
if ATTR_DIAGNOSTICS in body:
|
||||||
self.sys_config.diagnostics = body[ATTR_DIAGNOSTICS]
|
self.sys_config.diagnostics = body[ATTR_DIAGNOSTICS]
|
||||||
|
self.sys_dbus.agent.diagnostics = body[ATTR_DIAGNOSTICS]
|
||||||
|
|
||||||
if ATTR_LOGGING in body:
|
if ATTR_LOGGING in body:
|
||||||
self.sys_config.logging = body[ATTR_LOGGING]
|
self.sys_config.logging = body[ATTR_LOGGING]
|
||||||
|
@ -153,6 +153,12 @@ class Core(CoreSysAttributes):
|
|||||||
self.sys_resolution.unhealthy = UnhealthyReason.SETUP
|
self.sys_resolution.unhealthy = UnhealthyReason.SETUP
|
||||||
self.sys_capture_exception(err)
|
self.sys_capture_exception(err)
|
||||||
|
|
||||||
|
# Set OS Agent diagnostics if needed
|
||||||
|
if self.sys_config.diagnostics is not None and (
|
||||||
|
self.sys_dbus.agent.diagnostics != self.sys_config.diagnostics
|
||||||
|
):
|
||||||
|
self.sys_dbus.agent.diagnostics = self.sys_config.diagnostics
|
||||||
|
|
||||||
# Evaluate the system
|
# Evaluate the system
|
||||||
await self.sys_resolution.evaluate.evaluate_system()
|
await self.sys_resolution.evaluate.evaluate_system()
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ class OSAgent(DBusInterface):
|
|||||||
return self.properties[DBUS_ATTR_DIAGNOSTICS]
|
return self.properties[DBUS_ATTR_DIAGNOSTICS]
|
||||||
|
|
||||||
@diagnostics.setter
|
@diagnostics.setter
|
||||||
|
@dbus_property
|
||||||
def diagnostics(self, value: bool) -> None:
|
def diagnostics(self, value: bool) -> None:
|
||||||
"""Enable or disable OS-Agent diagnostics."""
|
"""Enable or disable OS-Agent diagnostics."""
|
||||||
asyncio.create_task(
|
asyncio.create_task(
|
||||||
|
@ -13,7 +13,7 @@ def dbus_property(func):
|
|||||||
def wrapper(*args, **kwds):
|
def wrapper(*args, **kwds):
|
||||||
try:
|
try:
|
||||||
return func(*args, **kwds)
|
return func(*args, **kwds)
|
||||||
except KeyError:
|
except (KeyError, AttributeError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user