nmcli/connections: make sure the connection has a base setting

Do the same bookkeeping as would happen upon setting the "type" option
when the connection has a connection.type set upon its addition.

Otherwise the --ask mode is sad:

  $ nmcli --ask c add connection.type team
  ** nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting)
  Bail out! nm:ERROR:src/nmcli/connections.c:5648:connection_get_base_meta_setting_type: assertion failed: (base_setting)
  Aborted (core dumped)
This commit is contained in:
Lubomir Rintel 2022-06-24 00:30:04 +02:00
parent e3fa6dfd7f
commit 647e255362

View file

@ -5891,6 +5891,12 @@ read_properties:
if (nmc->complete)
goto finish;
if (!enable_type_settings_and_options(connection, &error)) {
g_string_assign(nmc->return_text, error->message);
nmc->return_value = error->code;
goto finish;
}
/* Now ask user for the rest of the mandatory options. */
if (nmc->ask)
questionnaire_mandatory(nmc, connection);