From 2c23b0ecb473a9d4fb1d75133f0a8606b4e8b0d0 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 22 Aug 2015 20:51:14 +0530 Subject: [PATCH] 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. --- plinth/network.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plinth/network.py b/plinth/network.py index 1751eb59d..9bbec500f 100644 --- a/plinth/network.py +++ b/plinth/network.py @@ -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