diff options
author | Dan Winship <danw@redhat.com> | 2014-12-16 09:18:31 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2014-12-17 10:15:45 -0500 |
commit | 15a5d6cd57e8a0009ad0842f3c64f8eb51193ae8 (patch) | |
tree | 7bcc4987e122e394c3bd10b41375975361a16103 | |
parent | 9f0f9623892341475cd1095aa9a39d03311b2874 (diff) | |
download | NetworkManager-15a5d6cd57e8a0009ad0842f3c64f8eb51193ae8.tar.gz |
ifcfg-rh: remove "ignore_error" arg from connection_from_file()
Instead of having connection_from_file() return a flag telling its
caller whether to log a warning or not, just have it log the warning
(or not) itself.
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 8 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.h | 3 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/plugin.c | 21 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.c | 13 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.h | 3 |
5 files changed, 17 insertions, 31 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c index caa1f4ba21..ec143edd03 100644 --- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c +++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c @@ -102,8 +102,7 @@ files_changed_cb (NMInotifyHelper *ih, NMIfcfgConnection * nm_ifcfg_connection_new (NMConnection *source, const char *full_path, - GError **error, - gboolean *ignore_error) + GError **error) { GObject *object; NMConnection *tmp; @@ -119,8 +118,7 @@ nm_ifcfg_connection_new (NMConnection *source, else { tmp = connection_from_file (full_path, &unhandled_spec, - error, - ignore_error); + error); if (!tmp) return NULL; @@ -259,7 +257,7 @@ commit_changes (NMSettingsConnection *connection, * it if it's really changed. */ if (priv->path) { - reread = connection_from_file (priv->path, NULL, NULL, NULL); + reread = connection_from_file (priv->path, NULL, NULL); if (reread) { same = nm_connection_compare (NM_CONNECTION (connection), reread, diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.h b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.h index 37eacaf0d3..58576d9d15 100644 --- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.h +++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.h @@ -48,8 +48,7 @@ GType nm_ifcfg_connection_get_type (void); NMIfcfgConnection *nm_ifcfg_connection_new (NMConnection *source, const char *full_path, - GError **error, - gboolean *ignore_error); + GError **error); const char *nm_ifcfg_connection_get_path (NMIfcfgConnection *self); diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 2dced56b49..60ffcc7f84 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -129,23 +129,13 @@ _internal_new_connection (SCPluginIfcfg *self, SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); NMIfcfgConnection *connection; const char *cid; - GError *local = NULL; - gboolean ignore_error = FALSE; if (!source) nm_log_info (LOGD_SETTINGS, "parsing %s ... ", path); - connection = nm_ifcfg_connection_new (source, path, &local, &ignore_error); - if (!connection) { - if (!ignore_error) - nm_log_warn (LOGD_SETTINGS, " %s", (local && local->message) ? local->message : "(unknown)"); - if (local) - g_propagate_error (error, local); - else - g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, - "(unknown)"); + connection = nm_ifcfg_connection_new (source, path, error); + if (!connection) return NULL; - } cid = nm_connection_get_id (NM_CONNECTION (connection)); g_assert (cid); @@ -248,7 +238,6 @@ connection_new_or_changed (SCPluginIfcfg *self, SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); NMIfcfgConnection *new; GError *error = NULL; - gboolean ignore_error = FALSE; const char *new_unmanaged = NULL, *old_unmanaged = NULL; const char *new_unrecognized = NULL, *old_unrecognized = NULL; gboolean unmanaged_changed, unrecognized_changed; @@ -285,13 +274,9 @@ connection_new_or_changed (SCPluginIfcfg *self, return; } - new = (NMIfcfgConnection *) nm_ifcfg_connection_new (NULL, path, &error, &ignore_error); + new = (NMIfcfgConnection *) nm_ifcfg_connection_new (NULL, path, NULL); if (!new) { /* errors reading connection; remove it */ - if (!ignore_error) - nm_log_warn (LOGD_SETTINGS, " %s", (error && error->message) ? error->message : "(unknown)"); - g_clear_error (&error); - nm_log_info (LOGD_SETTINGS, "removed %s.", path); remove_connection (self, existing); return; diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 1c2b566d1f..171fb13398 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -4842,14 +4842,19 @@ done: NMConnection * connection_from_file (const char *filename, char **out_unhandled, - GError **error, - gboolean *out_ignore_error) + GError **error) { - return connection_from_file_full (filename, NULL, NULL, + gboolean ignore_error = FALSE; + NMConnection *conn; + + conn = connection_from_file_full (filename, NULL, NULL, out_unhandled, NULL, NULL, NULL, error, - out_ignore_error); + &ignore_error); + if (error && *error && !ignore_error) + PARSE_WARNING ("%s", (*error)->message); + return conn; } NMConnection * diff --git a/src/settings/plugins/ifcfg-rh/reader.h b/src/settings/plugins/ifcfg-rh/reader.h index 7fafc56783..15d5bac36e 100644 --- a/src/settings/plugins/ifcfg-rh/reader.h +++ b/src/settings/plugins/ifcfg-rh/reader.h @@ -28,8 +28,7 @@ NMConnection *connection_from_file (const char *filename, char **out_unhandled, - GError **error, - gboolean *out_ignore_error); + GError **error); char *uuid_from_file (const char *filename); |