Use new format for logging exceptions - host/services.py (#3213)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
This commit is contained in:
Anand Borkar 2021-10-08 13:51:47 +05:30 committed by GitHub
parent 79d541185f
commit 394d66290d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,12 +26,12 @@ class ServiceManager(CoreSysAttributes):
def _check_dbus(self, unit=None):
"""Check available dbus connection."""
if not self.sys_dbus.systemd.is_connected:
_LOGGER.error("No systemd D-Bus connection available")
raise HostNotSupportedError()
raise HostNotSupportedError(
"No systemd D-Bus connection available", _LOGGER.error
)
if unit and not self.exists(unit):
_LOGGER.error("Unit '%s' not found", unit)
raise HostServiceError()
raise HostServiceError(f"Unit '{unit}' not found", _LOGGER.error)
def start(self, unit):
"""Start a service on host."""