mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 06:28:05 +02:00
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.
(cherry picked from commit 12bfaf5a8d)
This commit is contained in:
parent
03e1227277
commit
bba1768353
5 changed files with 17 additions and 31 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -4846,14 +4846,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 *
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue