diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-11 11:35:11 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-11 11:52:05 +0100 |
commit | 8d20b9363b4461c7e86f2310a2fbfe88a09d5284 (patch) | |
tree | ce05c07816c878ed0eba7c8e12c827f3ac09658a | |
parent | 6998c5f129f70d676698de07667d6ee0334839ce (diff) | |
download | NetworkManager-8d20b9363b4461c7e86f2310a2fbfe88a09d5284.tar.gz |
config: add nm_config_data_get_warnings() to get additional warnings about wrong configuration
No additional warnings are implemented yet.
-rw-r--r-- | src/nm-config-data.c | 8 | ||||
-rw-r--r-- | src/nm-config-data.h | 3 | ||||
-rw-r--r-- | src/nm-config.c | 14 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/nm-config-data.c b/src/nm-config-data.c index 8f53304aa6..d8146457a3 100644 --- a/src/nm-config-data.c +++ b/src/nm-config-data.c @@ -1598,6 +1598,14 @@ nm_config_data_diff (NMConfigData *old_data, NMConfigData *new_data) /*****************************************************************************/ +void +nm_config_data_get_warnings (const NMConfigData *self, + GPtrArray *warnings) +{ +} + +/*****************************************************************************/ + static void get_property (GObject *object, guint prop_id, diff --git a/src/nm-config-data.h b/src/nm-config-data.h index f83ab92874..2a3f2a89eb 100644 --- a/src/nm-config-data.h +++ b/src/nm-config-data.h @@ -234,6 +234,9 @@ void nm_global_dns_config_free (NMGlobalDnsConfig *dns_config); NMGlobalDnsConfig *nm_global_dns_config_from_dbus (const GValue *value, GError **error); void nm_global_dns_config_to_dbus (const NMGlobalDnsConfig *dns_config, GValue *value); +void nm_config_data_get_warnings (const NMConfigData *self, + GPtrArray *warnings); + /* private accessors */ GKeyFile *_nm_config_data_get_keyfile (const NMConfigData *self); GKeyFile *_nm_config_data_get_keyfile_user (const NMConfigData *self); diff --git a/src/nm-config.c b/src/nm-config.c index 7d5be95c61..a7bb350302 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -2603,11 +2603,6 @@ nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags, gboolean emi return; } - if (emit_warnings) { - for (i = 0; i < warnings->len; i++) - _LOGW ("%s", (const char *) warnings->pdata[i]); - } - no_auto_default = no_auto_default_from_file (priv->no_auto_default_file); keyfile_intern = intern_config_read (priv->intern_config_file, @@ -2624,6 +2619,13 @@ nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags, gboolean emi (const char *const*) no_auto_default, keyfile, keyfile_intern); + + if (emit_warnings) { + nm_config_data_get_warnings (priv->config_data_orig, warnings); + for (i = 0; i < warnings->len; i++) + _LOGW ("%s", (const char *) warnings->pdata[i]); + } + g_free (config_main_file); g_free (config_description); g_key_file_unref (keyfile); @@ -2855,6 +2857,8 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) keyfile, keyfile_intern); + nm_config_data_get_warnings (priv->config_data_orig, warnings); + priv->config_data = g_object_ref (priv->config_data_orig); if (warnings->len > 0) { g_ptr_array_add (warnings, NULL); |