diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2023-07-24 16:18:08 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-07-25 15:39:06 +0200 |
commit | 5e75f0c197d67d7b9cb84eb12caaac235c802c83 (patch) | |
tree | 7728661bc19f40d727beef2caa9b76da8a93eb56 | |
parent | 52cca91dd29eeaab110bf979f70fb827d8c4a1b8 (diff) |
settings: move warning about ifcfg-rh
Move the warning about the presence of ifcfg-rh profiles from the
plugin to NMSettings. In this way, it will be easier to implement the
migration option in the next commit.
-rw-r--r-- | src/core/settings/nm-settings.c | 35 | ||||
-rw-r--r-- | src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 10 |
2 files changed, 29 insertions, 16 deletions
diff --git a/src/core/settings/nm-settings.c b/src/core/settings/nm-settings.c index 5fc2db8cc3..e3f63ffff2 100644 --- a/src/core/settings/nm-settings.c +++ b/src/core/settings/nm-settings.c @@ -1469,10 +1469,15 @@ static void _plugin_connections_reload(NMSettings *self) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE(self); - GSList *iter; - - for (iter = priv->plugins; iter; iter = iter->next) { - nm_settings_plugin_reload_connections(iter->data, _plugin_connections_reload_cb, self); + GSList *iter_plugin; + GHashTableIter iter_entry; + SettConnEntry *entry; + gboolean warned = FALSE; + + for (iter_plugin = priv->plugins; iter_plugin; iter_plugin = iter_plugin->next) { + nm_settings_plugin_reload_connections(iter_plugin->data, + _plugin_connections_reload_cb, + self); } _connection_changed_process_all_dirty( @@ -1485,8 +1490,26 @@ _plugin_connections_reload(NMSettings *self) | NM_SETTINGS_CONNECTION_UPDATE_REASON_RESET_AGENT_SECRETS | NM_SETTINGS_CONNECTION_UPDATE_REASON_UPDATE_NON_SECRET); - for (iter = priv->plugins; iter; iter = iter->next) - nm_settings_plugin_load_connections_done(iter->data); + for (iter_plugin = priv->plugins; iter_plugin; iter_plugin = iter_plugin->next) + nm_settings_plugin_load_connections_done(iter_plugin->data); + + g_hash_table_iter_init(&iter_entry, priv->sce_idx); + while (g_hash_table_iter_next(&iter_entry, (gpointer *) &entry, NULL)) { + const char *plugin; + + plugin = nm_settings_plugin_get_plugin_name(nm_settings_storage_get_plugin(entry->storage)); + + if (nm_streq0(plugin, "ifcfg-rh")) { + if (!warned) { + nm_log_info( + LOGD_SETTINGS, + "Warning: the ifcfg-rh plugin is deprecated, please migrate connections " + "to the keyfile format using \"nmcli connection migrate\""); + warned = TRUE; + break; + } + } + } } /*****************************************************************************/ diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index f68a4e0e03..0a3852474d 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -52,8 +52,6 @@ typedef struct { GHashTable *unmanaged_specs; GHashTable *unrecognized_specs; - - gboolean warned; } NMSIfcfgRHPluginPrivate; struct _NMSIfcfgRHPlugin { @@ -178,7 +176,6 @@ nm_assert_self(NMSIfcfgRHPlugin *self, gboolean unhandled_specs_consistent) static NMSIfcfgRHStorage * _load_file(NMSIfcfgRHPlugin *self, const char *filename, GError **error) { - NMSIfcfgRHPluginPrivate *priv = NMS_IFCFG_RH_PLUGIN_GET_PRIVATE(self); NMSIfcfgRHStorage *ret = NULL; gs_unref_object NMConnection *connection = NULL; gs_free_error GError *load_error = NULL; @@ -236,13 +233,6 @@ _load_file(NMSIfcfgRHPlugin *self, const char *filename, GError **error) &st.st_mtim); } - if (!priv->warned) { - nm_log_info(_NMLOG_DOMAIN, - "Warning: the ifcfg-rh plugin is deprecated, please migrate connections " - "to the keyfile format using \"nmcli connection migrate\"."); - priv->warned = TRUE; - } - return ret; } |