mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
networks: During activation raise device not found
When an interface assigned to a connection is not available in list of devices, raise a proper error that device is not found.
This commit is contained in:
parent
e7214b7586
commit
2c23b0ecb4
@ -327,16 +327,17 @@ def edit_wifi_connection(connection, name, interface, zone, ssid, mode,
|
||||
|
||||
def activate_connection(connection_uuid):
|
||||
"""Find and activate a network connection."""
|
||||
# Find the connection
|
||||
connection = get_connection(connection_uuid)
|
||||
interface = connection.get_interface_name()
|
||||
client = nm.Client.new(None)
|
||||
for device in client.get_devices():
|
||||
if device.get_iface() == interface:
|
||||
client.activate_connection_async(connection,
|
||||
device,
|
||||
'/', None, _callback,
|
||||
None)
|
||||
client.activate_connection_async(
|
||||
connection, device, '/', None, _callback, None)
|
||||
break
|
||||
else:
|
||||
raise DeviceNotFound(connection)
|
||||
|
||||
return connection
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user