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
This commit is contained in:
Jiří Klimeš
2015-09-14 14:06:39 +02:00
parent 757999d484
commit f88ce92b25

View File

@@ -1575,11 +1575,17 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop,
(int *) &wol, &err_token); (int *) &wol, &err_token);
if (!ret) { if (!ret) {
g_set_error (error, 1, 0, _("invalid option '%s', use a combination of %s or 'default'"), if ( g_ascii_strcasecmp (err_token, "none") == 0
err_token, || g_ascii_strcasecmp (err_token, "disable") == 0
nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), || g_ascii_strcasecmp (err_token, "disabled") == 0)
NM_SETTING_WIRED_WAKE_ON_LAN_ALL)); wol = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
return FALSE; 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) && if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) &&