From f88ce92b2574b9f4388868d7f92a48ea71e93bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Mon, 14 Sep 2015 14:06:39 +0200 Subject: [PATCH] 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 --- clients/cli/settings.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 1132c862cc..f12bc95cd5 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -1575,11 +1575,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) &&