Skip to content

Commit 85d42bc

Browse files
committed
Remove connection_profile as it is replaced with get_profile
`connection_profile` was added early in to the development of settings dataclasses. However, it was incorrectly added to the object class rather than interface. `get_profile` is equivalent and can fetch secrets. No reason to keep duplicated functionality in before it is released to stable version.
1 parent 21fd294 commit 85d42bc

File tree

7 files changed

+8
-24
lines changed

7 files changed

+8
-24
lines changed

examples/async/list-connections-async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def list_connection_profiles_async() -> None:
3636

3737
async def print_connection_profile(connection_path: str) -> None:
3838
connectionsettings_service = NetworkConnectionSettings(connection_path)
39-
profile = await connectionsettings_service.connection_profile()
39+
profile = await connectionsettings_service.get_profile()
4040
connection = profile.connection
4141
print("-------------------------------------------------------------")
4242
print("name:", connection.connection_id)

examples/async/netdevinfo-async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def get_most_recent_connection_id(ifname: str, dev_type: str) -> Optional[
4343
conns = {}
4444
for connection_path in connection_paths:
4545
connection_manager = NetworkConnectionSettings(connection_path)
46-
connection = (await connection_manager.connection_profile()).connection
46+
connection = (await connection_manager.get_profile()).connection
4747
# Filter connection profiles matching the connection type for the device:
4848
if connection.connection_type != getattr(ConnectionType, dev_type):
4949
continue

examples/async/update-connection-async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Update a property of a connection profile, looked up by connection id
55
#
6-
# This version uses connection_manager.connection_profile().to_settings_dict()
6+
# This version uses connection_manager.get_profile().to_settings_dict()
77
# to retrieve the connection profile from NetworkManager as a settings dict.
88
#
99
# It then updates it dynamically using the given arguments:
@@ -34,9 +34,9 @@ async def update_connection_async(args: Dict[str, Any]) -> None:
3434
print(f"No connection {id}, create with add-wifi-psk-connection-async")
3535
return
3636

37-
# Get the profile settings of the first connecttion with given id
37+
# Get the profile settings of the first connection with given id
3838
connection_manager = NetworkConnectionSettings(connection_paths[0])
39-
existing_connection_profile = await connection_manager.connection_profile()
39+
existing_connection_profile = await connection_manager.get_profile()
4040
settings = existing_connection_profile.to_settings_dict()
4141

4242
# Update the given setting's property using the given value

examples/block/list-connections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def list_connection_profiles_blocking() -> None:
3131

3232

3333
def print_connection_profile_blocking(connection_path: str) -> None:
34-
"""Show the use of NetworkConnectionSettings(path).connection_profile()"""
35-
profile = NetworkConnectionSettings(connection_path).connection_profile()
34+
"""Show the use of NetworkConnectionSettings(path).get_profile()"""
35+
profile = NetworkConnectionSettings(connection_path).get_profile()
3636
print("-------------------------------------------------------------")
3737
print("name:", profile.connection.connection_id)
3838
print("uuid:", profile.connection.uuid)

examples/block/netdevinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_most_recent_connection_id(ifname: str, dev_type: str) -> Optional[str]:
4242
conns = {}
4343
for connection_path in connection_paths:
4444
connection_manager = NetworkConnectionSettings(connection_path)
45-
connection = connection_manager.connection_profile().connection
45+
connection = connection_manager.get_profile().connection
4646
# Filter connection profiles matching the connection type for the device:
4747
if connection.connection_type != getattr(ConnectionType, dev_type):
4848
continue

sdbus_async/networkmanager/objects.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
NetworkManagerVPNConnectionInterfaceAsync,
6868
NetworkManagerWifiP2PPeerInterfaceAsync,
6969
)
70-
from .settings.profile import ConnectionProfile
7170
from .types import NetworkManagerConnectionProperties
7271

7372
NETWORK_MANAGER_SERVICE_NAME = 'org.freedesktop.NetworkManager'
@@ -224,13 +223,6 @@ def __init__(self, settings_path: str,
224223
settings_path,
225224
bus)
226225

227-
async def connection_profile(self) -> ConnectionProfile:
228-
"""Return a ConnectionProfile object containing all profile settings
229-
230-
:return: Nested dataclass containing all settings of the profile
231-
"""
232-
return ConnectionProfile.from_dbus(await self.get_settings())
233-
234226

235227
class NetworkDeviceGeneric(
236228
NetworkManagerDeviceInterfaceAsync,

sdbus_block/networkmanager/objects.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
NetworkManagerVPNConnectionInterface,
6868
NetworkManagerWifiP2PPeerInterface,
6969
)
70-
from .settings.profile import ConnectionProfile
7170
from .types import NetworkManagerConnectionProperties
7271

7372
NETWORK_MANAGER_SERVICE_NAME = 'org.freedesktop.NetworkManager'
@@ -213,13 +212,6 @@ def __init__(self, settings_path: str,
213212
settings_path,
214213
bus)
215214

216-
def connection_profile(self) -> ConnectionProfile:
217-
"""Return a ConnectionProfile object containing all profile settings
218-
219-
:return: Nested dataclass containing all settings of the profile
220-
"""
221-
return ConnectionProfile.from_dbus(self.get_settings())
222-
223215

224216
class NetworkDeviceGeneric(
225217
NetworkManagerDeviceInterface,

0 commit comments

Comments
 (0)