From 3d14d52325525d3fe2db3f1e039ef2aa3378d860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Tue, 8 Oct 2013 12:24:05 +0200 Subject: [PATCH] cli: copy remote connection to local one on 'save' (rh #997958) Plugins may have problems with preserving some properties on write/read cycle, may add ipv{4,6} settings when they are not present in the connection, etc. That makes local and remote connection differ. So we copy remote connection into the local to get rid of such problems. Note: 68f12b4e9c134d41e42cc8a1986cad6bb3c07b7a and f03635e5ac829d4fc896573f2f3c6969b9d5a2e2 commits ensure that all connection (except slaves) have IPv{4,6} settings. https://bugzilla.redhat.com/show_bug.cgi?id=997958 --- cli/src/connections.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cli/src/connections.c b/cli/src/connections.c index d27fae88bf..a3fd5c2187 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -6288,11 +6288,25 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t nmc_editor_error->code, nmc_editor_error->message); g_error_free (nmc_editor_error); - } else + } else { + NMRemoteConnection *con_tmp; + printf (_("Connection '%s' (%s) successfully saved.\n"), nm_connection_get_id (connection), nm_connection_get_uuid (connection)); + /* Replace local connection with the remote one to be sure they are equal. + * This mitigates problems with plugins not preserving some properties or + * adding ipv{4,6} settings when not present. + */ + con_tmp = nm_remote_settings_get_connection_by_uuid (nmc->system_settings, + nm_connection_get_uuid (connection)); + if (con_tmp) + nm_connection_replace_settings_from_connection (connection, + NM_CONNECTION (con_tmp), + NULL); + } + nmc_editor_cb_called = FALSE; nmc_editor_error = NULL; g_mutex_unlock (&nmc_editor_mutex);