Commit 4b94e8f
Fix NetworkManagerSettings.get_connections_by_id not using the bus it was initialized with
The get_connections_by_id does not work properly with explicitly passed bus, and raises the following exception:
settings_paths = await nm_settings.get_connections_by_id("eth0")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../networkmanager/objects.py", line 177, in get_connections_by_id
settings_properties = await settings.get_settings()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../dbus_proxy_async_method.py", line 108, in _dbus_async_call
reply_message = await bus.call_async(call_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sdbus.dbus_exceptions.DbusServiceUnknownError: The name org.freedesktop.NetworkManager was not provided by any .service files
This exception was discovered with the following test code:
import asyncio
from sdbus import sd_bus_open_system
from sdbus_async.networkmanager import NetworkManagerSettings
async def test_get_connections_by_id():
system_bus = sd_bus_open_system()
nm_settings = NetworkManagerSettings(system_bus)
settings_paths = await nm_settings.get_connections_by_id("eth0")
print(settings_paths)
if __name__ == "__main__":
asyncio.run(test_get_connections_by_id())
After this fix, the issue is resolved and get_connections_by_id works correctly without raising an exception.1 parent ff0567f commit 4b94e8f
File tree
2 files changed
+4
-2
lines changed- sdbus_async/networkmanager
- sdbus_block/networkmanager
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
| |||
0 commit comments