From 6eaaa3bc9b8f54ebd06e8def57c172933b2f6131 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 30 Apr 2025 23:21:20 +0200 Subject: systemd.dbussy: call StartTransientUnit asynchronously Fixes: b0874c6086f1 ("lift the dbus functionality from the cgroup example") Fixes: bb83f3fe1bec ("add examples/cgroup.py: writeable cgroup hierarchy") --- linuxnamespaces/systemd/dbussy.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/linuxnamespaces/systemd/dbussy.py b/linuxnamespaces/systemd/dbussy.py index 77410df..47c375a 100644 --- a/linuxnamespaces/systemd/dbussy.py +++ b/linuxnamespaces/systemd/dbussy.py @@ -72,10 +72,15 @@ async def start_transient_unit( """ bus = await ravel.session_bus_async() with SystemdJobWaiter(bus) as wait: + systemd1 = bus["org.freedesktop.systemd1"]["/org/freedesktop/systemd1"] result = await wait( - bus["org.freedesktop.systemd1"]["/org/freedesktop/systemd1"] - .get_interface("org.freedesktop.systemd1.Manager") - .StartTransientUnit(unitname, "fail", properties, [])[0], + ( + await ( + await systemd1.get_async_interface( + "org.freedesktop.systemd1.Manager" + ) + ).StartTransientUnit(unitname, "fail", properties, []) + )[0], ) if result != "done": raise OSError("StartTransientUnit failed: " + result) -- cgit v1.2.3