mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 07:48:10 +02:00
core: improve error message when activating profile on device
Before:
$ nmcli connection up my-wired ifname eth0
Error: Connection activation failed: Connection 'my-wired' is not available on the device eth0 at this time.
After:
$ nmcli connection up my-wired ifname eth0
Error: Connection activation failed: Connection 'my-wired' is not available on device eth0 because device has no carrier
This commit is contained in:
parent
7bad40109e
commit
e9f6bb0bbb
1 changed files with 7 additions and 3 deletions
|
|
@ -4087,6 +4087,7 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
|
||||||
NMConnection *existing_connection = NULL;
|
NMConnection *existing_connection = NULL;
|
||||||
NMActiveConnection *master_ac = NULL;
|
NMActiveConnection *master_ac = NULL;
|
||||||
NMAuthSubject *subject;
|
NMAuthSubject *subject;
|
||||||
|
GError *local = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_MANAGER (self), FALSE);
|
g_return_val_if_fail (NM_IS_MANAGER (self), FALSE);
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE);
|
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE);
|
||||||
|
|
@ -4120,10 +4121,13 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Final connection must be available on device */
|
/* Final connection must be available on device */
|
||||||
if (!nm_device_check_connection_available (device, applied, NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, NULL)) {
|
if (!nm_device_check_connection_available (device, applied, NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, &local)) {
|
||||||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
|
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
|
||||||
"Connection '%s' is not available on the device %s at this time.",
|
"Connection '%s' is not available on device %s because %s",
|
||||||
nm_settings_connection_get_id (connection), nm_device_get_iface (device));
|
nm_settings_connection_get_id (connection),
|
||||||
|
nm_device_get_iface (device),
|
||||||
|
local->message);
|
||||||
|
g_error_free (local);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue