summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-06-14 16:05:04 -0400
committerColin Walters <walters@verbum.org>2013-06-24 15:46:55 -0400
commit8ba5c0f19e7753b54ef4042de33c23526f9373e3 (patch)
tree91b4e8c64865d275e50d4169954c67d56084a1ba
parentcd54306f313d868211147a5a8b519b0252723213 (diff)
config: Include overrides in parsed config file messagewip/main-ordering
Useful to see which files are being read.
-rw-r--r--src/config/nm-config.c23
-rw-r--r--src/config/nm-config.h1
-rw-r--r--src/main.c2
3 files changed, 24 insertions, 2 deletions
diff --git a/src/config/nm-config.c b/src/config/nm-config.c
index 4820056f..409352b4 100644
--- a/src/config/nm-config.c
+++ b/src/config/nm-config.c
@@ -39,6 +39,7 @@
typedef struct {
char *nm_conf_path;
char *config_dir;
+ char *config_description;
char *no_auto_default_file;
GKeyFile *keyfile;
@@ -74,6 +75,14 @@ nm_config_get_path (NMConfig *config)
return NM_CONFIG_GET_PRIVATE (config)->nm_conf_path;
}
+const char *
+nm_config_get_description (NMConfig *config)
+{
+ g_return_val_if_fail (config != NULL, NULL);
+
+ return NM_CONFIG_GET_PRIVATE (config)->config_description;
+}
+
const char **
nm_config_get_plugins (NMConfig *config)
{
@@ -292,6 +301,8 @@ read_config (NMConfig *config, const char *path, GError **error)
return FALSE;
}
+ nm_log_dbg (LOGD_SETTINGS, "Reading config file '%s'", path);
+
kf = g_key_file_new ();
g_key_file_set_list_separator (kf, ',');
if (!g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, error)) {
@@ -422,6 +433,7 @@ nm_config_new (GError **error)
const char *name;
char *value;
int i;
+ GString *config_description;
g_assert (!singleton);
singleton = NM_CONFIG (g_object_new (NM_TYPE_CONFIG, NULL));
@@ -441,13 +453,20 @@ nm_config_new (GError **error)
priv->config_dir = g_strdup (NM_DEFAULT_SYSTEM_CONF_DIR);
confs = g_ptr_array_new_with_free_func (g_free);
+ config_description = g_string_new (priv->nm_conf_path);
dir = g_file_new_for_path (priv->config_dir);
direnum = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, NULL);
if (direnum) {
while ((info = g_file_enumerator_next_file (direnum, NULL, NULL))) {
name = g_file_info_get_name (info);
- if (g_str_has_suffix (name, ".conf"))
+ if (g_str_has_suffix (name, ".conf")) {
g_ptr_array_add (confs, g_build_filename (priv->config_dir, name, NULL));
+ if (confs->len == 1)
+ g_string_append (config_description, " and conf.d: ");
+ else
+ g_string_append (config_description, ", ");
+ g_string_append (config_description, name);
+ }
g_object_unref (info);
}
g_object_unref (direnum);
@@ -455,6 +474,7 @@ nm_config_new (GError **error)
g_object_unref (dir);
g_ptr_array_sort (confs, sort_asciibetically);
+ priv->config_description = g_string_free (config_description, FALSE);
for (i = 0; i < confs->len; i++) {
if (!read_config (singleton, confs->pdata[i], error)) {
g_object_unref (singleton);
@@ -534,6 +554,7 @@ finalize (GObject *gobject)
g_free (priv->nm_conf_path);
g_free (priv->config_dir);
+ g_free (priv->config_description);
g_free (priv->no_auto_default_file);
g_clear_pointer (&priv->keyfile, g_key_file_unref);
g_strfreev (priv->plugins);
diff --git a/src/config/nm-config.h b/src/config/nm-config.h
index 6518fb33..14635d8d 100644
--- a/src/config/nm-config.h
+++ b/src/config/nm-config.h
@@ -49,6 +49,7 @@ GType nm_config_get_type (void);
NMConfig *nm_config_get (void);
const char *nm_config_get_path (NMConfig *config);
+const char *nm_config_get_description (NMConfig *config);
const char **nm_config_get_plugins (NMConfig *config);
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
const char *nm_config_get_dhcp_client (NMConfig *config);
diff --git a/src/main.c b/src/main.c
index 85045f57..6c97de29 100644
--- a/src/main.c
+++ b/src/main.c
@@ -527,7 +527,7 @@ main (int argc, char *argv[])
nm_log_info (LOGD_CORE, "NetworkManager (version " NM_DIST_VERSION ") is starting...");
success = FALSE;
- nm_log_info (LOGD_CORE, "Read config file %s", nm_config_get_path (config));
+ nm_log_info (LOGD_CORE, "Read config: %s", nm_config_get_description (config));
nm_log_info (LOGD_CORE, "WEXT support is %s",
#if HAVE_WEXT
"enabled"