diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-09-14 14:06:39 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-09-15 12:17:26 +0200 |
commit | 65f6bb0b7b5baf9b92906ca5b0259f901bb57bb7 (patch) | |
tree | 5ac7cc6ed3d5cce37f4b9192ff93a8e73003b94f | |
parent | 1ec0b4e7e889b7cedfd1883a48561c35b19cafdf (diff) | |
download | NetworkManager-65f6bb0b7b5baf9b92906ca5b0259f901bb57bb7.tar.gz |
nmcli: allow "none" value for ethernet.wake-on-lan property (rh #1260584)
Aliases "disable" and "disabled" are accepted too.
nmcli> set 802-3-ethernet.wake-on-lan none
It was possible to remove flags by setting a string containing just white
spaces, but it was user unfriendly and non-intuitive.
https://bugzilla.redhat.com/show_bug.cgi?id=1260584
(cherry picked from commit f88ce92b2574b9f4388868d7f92a48ea71e93bb8)
-rw-r--r-- | clients/cli/settings.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 952681d2cd..5ca80b44e1 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -1541,11 +1541,17 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop, (int *) &wol, &err_token); if (!ret) { - g_set_error (error, 1, 0, _("invalid option '%s', use a combination of %s or 'default'"), - err_token, - nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), - NM_SETTING_WIRED_WAKE_ON_LAN_ALL)); - return FALSE; + if ( g_ascii_strcasecmp (err_token, "none") == 0 + || g_ascii_strcasecmp (err_token, "disable") == 0 + || g_ascii_strcasecmp (err_token, "disabled") == 0) + wol = NM_SETTING_WIRED_WAKE_ON_LAN_NONE; + else { + g_set_error (error, 1, 0, _("invalid option '%s', use a combination of %s or 'default' or 'none'"), + err_token, + nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), + NM_SETTING_WIRED_WAKE_ON_LAN_ALL)); + return FALSE; + } } if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) && |