cli: don't look up a device for activation request unless we have to

Let the server decide which device to use if the user didn't explicitly
specify the interface, wireless access point or a wimax nsp.

The server will just reuse the device for an already active connection
or potentially do a better guess.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
This commit is contained in:
Lubomir Rintel 2015-02-01 09:09:37 +01:00
parent 4cb97cf66f
commit 0e8a14cc5f

View file

@ -1723,6 +1723,7 @@ find_device_for_connection (NmCli *nmc,
int i, j;
g_return_val_if_fail (nmc != NULL, FALSE);
g_return_val_if_fail (iface || ap || nsp, FALSE);
g_return_val_if_fail (device != NULL && *device == NULL, FALSE);
g_return_val_if_fail (spec_object != NULL && *spec_object == NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@ -2208,7 +2209,7 @@ nmc_activate_connection (NmCli *nmc,
g_return_val_if_fail (nmc != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (connection) {
if (connection && (ifname || ap || nsp)) {
device_found = find_device_for_connection (nmc, connection, ifname, ap, nsp, &device, &spec_object, &local);
/* Virtual connection may not have their interfaces created yet */
@ -2226,7 +2227,7 @@ nmc_activate_connection (NmCli *nmc,
_("unknown device '%s'."), ifname);
return FALSE;
}
} else {
} else if (!connection) {
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_NOT_FOUND,
_("neither a valid connection nor device given"));
return FALSE;