You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments