mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 23:40:33 +01:00
config: add file name to error messages for parsing failures
When one of the configuration snippet is malformed, NM doesn't tell which file caused the error: $ NetworkManager --print-config Failed to read configuration: Key file does not start with a group Fix this. $ NetworkManager --print-config Failed to read configuration: /usr/lib/NetworkManager/conf.d/test.conf: Key file does not start with a group
This commit is contained in:
parent
77e7a9c075
commit
57c001200d
1 changed files with 3 additions and 4 deletions
|
|
@ -669,6 +669,7 @@ read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, co
|
|||
|
||||
kf = nm_config_create_keyfile ();
|
||||
if (!g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, error)) {
|
||||
g_prefix_error (error, "%s: ", path);
|
||||
g_key_file_free (kf);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -850,8 +851,7 @@ read_base_config (GKeyFile *keyfile,
|
|||
}
|
||||
|
||||
if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
|
||||
nm_log_warn (LOGD_CORE, "Old default config file %s invalid: %s\n",
|
||||
DEFAULT_CONFIG_MAIN_FILE_OLD,
|
||||
nm_log_warn (LOGD_CORE, "Old default config file invalid: %s\n",
|
||||
my_error->message);
|
||||
}
|
||||
g_clear_error (&my_error);
|
||||
|
|
@ -863,8 +863,7 @@ read_base_config (GKeyFile *keyfile,
|
|||
}
|
||||
|
||||
if (!g_error_matches (my_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
|
||||
nm_log_warn (LOGD_CORE, "Default config file %s invalid: %s\n",
|
||||
DEFAULT_CONFIG_MAIN_FILE,
|
||||
nm_log_warn (LOGD_CORE, "Default config file invalid: %s\n",
|
||||
my_error->message);
|
||||
g_propagate_error (error, my_error);
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue