From 41d9b13e716ffef37788ce18395c967a528cce13 Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Tue, 22 Apr 2025 10:57:42 +0200 Subject: [PATCH] fix(dbus): Update systemd interface and path handling Revised DBus interactions to explicitly use `org.freedesktop.systemd1` interface and path. This ensures that the correct interfaces are used and bypasses ".systemd1" magic from the library `pydbus`. --- .../system_config/revpi_config.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/revpi_middleware/dbus_middleware1/system_config/revpi_config.py b/src/revpi_middleware/dbus_middleware1/system_config/revpi_config.py index 23d6378..de1d4ce 100644 --- a/src/revpi_middleware/dbus_middleware1/system_config/revpi_config.py +++ b/src/revpi_middleware/dbus_middleware1/system_config/revpi_config.py @@ -324,7 +324,11 @@ def configure_gui(action: ConfigActions): return gui_available bus = SystemBus() - systemd_manager = bus.get(".systemd1") + systemd = bus.get( + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + ) + systemd_manager = systemd["org.freedesktop.systemd1.Manager"] if action is ConfigActions.ENABLE: systemd_manager.SetDefaultTarget("graphical.target", True) @@ -384,7 +388,11 @@ def get_rfkill_index(device_class_path: str) -> Optional[int]: def simple_systemd(action: ConfigActions, unit: str): bus = SystemBus() - systemd_manager = bus.get(".systemd1") + systemd = bus.get( + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + ) + systemd_manager = systemd["org.freedesktop.systemd1.Manager"] if action is ConfigActions.ENABLE: systemd_manager.UnmaskUnitFiles([unit], False) @@ -398,7 +406,7 @@ def simple_systemd(action: ConfigActions, unit: str): elif action is ConfigActions.STATUS: try: unit_path = systemd_manager.LoadUnit(unit) - properties = bus.get(".systemd1", unit_path) + properties = bus.get("org.freedesktop.systemd1", unit_path) except Exception: log.warning(f"could not get systemd unit {unit}") return False @@ -408,7 +416,7 @@ def simple_systemd(action: ConfigActions, unit: str): elif action is ConfigActions.AVAILABLE: try: unit_path = systemd_manager.LoadUnit(unit) - properties = bus.get(".systemd1", unit_path) + properties = bus.get("org.freedesktop.systemd1", unit_path) except Exception: log.warning(f"could not get systemd unit {unit}") return False