From 647e2553627d38f6a7c254d162cc9ea697c662f1 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 24 Jun 2022 00:30:04 +0200 Subject: 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) --- src/nmcli/connections.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index ae2cd71d61..3370277ae2 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -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); -- cgit v1.2.3