diff options
author | Helmut Grohne <helmut@subdivi.de> | 2025-04-30 23:21:20 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2025-04-30 23:21:20 +0200 |
commit | 6eaaa3bc9b8f54ebd06e8def57c172933b2f6131 (patch) | |
tree | 873b2c3958bdd5c641945d26e9fbc124fb16bc5e /linuxnamespaces/systemd | |
parent | d83171b1fbbb809f7e5ed0daeed4435132817158 (diff) | |
download | python-linuxnamespaces-6eaaa3bc9b8f54ebd06e8def57c172933b2f6131.tar.gz |
systemd.dbussy: call StartTransientUnit asynchronously
Fixes: b0874c6086f1 ("lift the dbus functionality from the cgroup example")
Fixes: bb83f3fe1bec ("add examples/cgroup.py: writeable cgroup hierarchy")
Diffstat (limited to 'linuxnamespaces/systemd')
-rw-r--r-- | linuxnamespaces/systemd/dbussy.py | 11 |
1 files 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) |