mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 14:10:08 +01:00
cli: don't reset default values in interactive add
Since commit40032f4614('cli: fix resetting values via property alias'), nmcli sets NULL properties during interactive add (nmcli -a connection add) when the user leaves the field blank. This can lead to an invalid connection for properties that can't be empty like infiniband.transport-mode; they should be left to the default value in case of no value entered. Fixes:40032f4614('cli: fix resetting values via property alias') Fixes-test: @inf_create_port_novice_mode https://bugzilla.redhat.com/show_bug.cgi?id=2053603 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1111 (cherry picked from commit5b4ce608d4)
This commit is contained in:
parent
9024ff49a1
commit
883f2c74aa
1 changed files with 4 additions and 3 deletions
|
|
@ -4189,6 +4189,7 @@ set_option(NmCli *nmc,
|
|||
NMConnection *connection,
|
||||
const NMMetaAbstractInfo *abstract_info,
|
||||
const char *value,
|
||||
gboolean allow_reset,
|
||||
GError **error)
|
||||
{
|
||||
const char *setting_name, *property_name, *option_name;
|
||||
|
|
@ -4209,7 +4210,7 @@ set_option(NmCli *nmc,
|
|||
NULL);
|
||||
if (option && option->check_and_set) {
|
||||
return option->check_and_set(nmc, connection, option, value, error);
|
||||
} else {
|
||||
} else if (value || allow_reset) {
|
||||
set_property(nmc->client,
|
||||
connection,
|
||||
setting_name,
|
||||
|
|
@ -5199,7 +5200,7 @@ nmc_process_connection_properties(NmCli *nmc,
|
|||
if (!*argc && nmc->complete)
|
||||
complete_option(nmc, chosen, value ?: "", connection);
|
||||
|
||||
if (!set_option(nmc, connection, chosen, value, error))
|
||||
if (!set_option(nmc, connection, chosen, value, TRUE, error))
|
||||
return FALSE;
|
||||
|
||||
} while (*argc);
|
||||
|
|
@ -5410,7 +5411,7 @@ again:
|
|||
if (multi && !value)
|
||||
return;
|
||||
|
||||
if (!set_option(nmc, connection, abstract_info, value, &error)) {
|
||||
if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) {
|
||||
g_printerr("%s\n", error->message);
|
||||
g_clear_error(&error);
|
||||
goto again;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue