diff --git a/sdbus_async/networkmanager/objects.py b/sdbus_async/networkmanager/objects.py index e03c69a..f5ae24e 100644 --- a/sdbus_async/networkmanager/objects.py +++ b/sdbus_async/networkmanager/objects.py @@ -159,6 +159,7 @@ def __init__(self, bus: Optional[SdBus] = None) -> None: NETWORK_MANAGER_SERVICE_NAME, '/org/freedesktop/NetworkManager/Settings', bus) + self._nm_used_bus = bus async def get_connections_by_id(self, connection_id: str) -> List[str]: """Helper method to get a list of connection profile paths @@ -171,7 +172,7 @@ async def get_connections_by_id(self, connection_id: str) -> List[str]: connection_paths_with_matching_id = [] connection_paths: List[str] = await self.connections for connection_path in connection_paths: - settings = NetworkConnectionSettings(connection_path) + settings = NetworkConnectionSettings(connection_path, self._nm_used_bus) settings_properites = await settings.get_settings() # settings_properites["connection"]["id"][1] gives the id value: if settings_properites["connection"]["id"][1] == connection_id: diff --git a/sdbus_block/networkmanager/objects.py b/sdbus_block/networkmanager/objects.py index 3d4c68d..ef48e29 100644 --- a/sdbus_block/networkmanager/objects.py +++ b/sdbus_block/networkmanager/objects.py @@ -154,6 +154,7 @@ def __init__(self, bus: Optional[SdBus] = None) -> None: NETWORK_MANAGER_SERVICE_NAME, '/org/freedesktop/NetworkManager/Settings', bus) + self._nm_used_bus = bus def get_connections_by_id(self, connection_id: str) -> List[str]: """Helper method to get a list of connection profile paths @@ -165,7 +166,7 @@ def get_connections_by_id(self, connection_id: str) -> List[str]: """ connection_paths_with_matching_id = [] for connection_path in self.connections: - profile = NetworkConnectionSettings(connection_path) + profile = NetworkConnectionSettings(connection_path, self._nm_used_bus) # profile.get_settings()["connection"]["id"][1] gives the id value: if profile.get_settings()["connection"]["id"][1] == connection_id: connection_paths_with_matching_id.append(connection_path)