config: add nm_config_data_get_warnings() to get additional warnings about wrong configuration

No additional warnings are implemented yet.
This commit is contained in:
Thomas Haller 2019-12-11 11:35:11 +01:00
parent 6998c5f129
commit 8d20b9363b
3 changed files with 20 additions and 5 deletions

View file

@ -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,

View file

@ -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);

View file

@ -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);