mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +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):
|
def activate_connection(connection_uuid):
|
||||||
"""Find and activate a network connection."""
|
"""Find and activate a network connection."""
|
||||||
# Find the connection
|
|
||||||
connection = get_connection(connection_uuid)
|
connection = get_connection(connection_uuid)
|
||||||
interface = connection.get_interface_name()
|
interface = connection.get_interface_name()
|
||||||
client = nm.Client.new(None)
|
client = nm.Client.new(None)
|
||||||
for device in client.get_devices():
|
for device in client.get_devices():
|
||||||
if device.get_iface() == interface:
|
if device.get_iface() == interface:
|
||||||
client.activate_connection_async(connection,
|
client.activate_connection_async(
|
||||||
device,
|
connection, device, '/', None, _callback, None)
|
||||||
'/', None, _callback,
|
break
|
||||||
None)
|
else:
|
||||||
|
raise DeviceNotFound(connection)
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user