ifcfg-rh: silence message about ignoring loopback config (rh #484060)

This commit is contained in:
Dan Williams 2009-02-04 11:28:27 -05:00
parent c2f228e7b7
commit 47f4d9945e
5 changed files with 26 additions and 14 deletions

View file

@ -242,7 +242,8 @@ NMIfcfgConnection *
nm_ifcfg_connection_new (const char *filename,
DBusGConnection *g_connection,
NMSystemConfigHalManager *hal_mgr,
GError **error)
GError **error,
gboolean *ignore_error)
{
GObject *object;
NMIfcfgConnectionPrivate *priv;
@ -254,7 +255,7 @@ nm_ifcfg_connection_new (const char *filename,
g_return_val_if_fail (filename != NULL, NULL);
wrapped = connection_from_file (filename, &unmanaged, &keyfile, error);
wrapped = connection_from_file (filename, &unmanaged, &keyfile, error, ignore_error);
if (!wrapped)
return NULL;

View file

@ -50,7 +50,8 @@ GType nm_ifcfg_connection_get_type (void);
NMIfcfgConnection *nm_ifcfg_connection_new (const char *filename,
DBusGConnection *g_connection,
NMSystemConfigHalManager *hal_mgr,
GError **error);
GError **error,
gboolean *ignore_error);
const char *nm_ifcfg_connection_get_filename (NMIfcfgConnection *self);

View file

@ -160,10 +160,11 @@ read_one_connection (SCPluginIfcfg *plugin, const char *filename)
SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin);
NMIfcfgConnection *connection;
GError *error = NULL;
gboolean ignore_error = FALSE;
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "parsing %s ... ", filename);
connection = nm_ifcfg_connection_new (filename, priv->g_connection, priv->hal_mgr, &error);
connection = nm_ifcfg_connection_new (filename, priv->g_connection, priv->hal_mgr, &error, &ignore_error);
if (connection) {
NMConnection *wrapped;
NMSettingConnection *s_con;
@ -198,8 +199,10 @@ read_one_connection (SCPluginIfcfg *plugin, const char *filename)
g_signal_connect (G_OBJECT (connection), "ifcfg-changed",
G_CALLBACK (connection_ifcfg_changed), plugin);
} else {
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, " error: %s",
(error && error->message) ? error->message : "(unknown)");
if (!ignore_error) {
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, " error: %s",
(error && error->message) ? error->message : "(unknown)");
}
g_error_free (error);
}
@ -284,7 +287,7 @@ connection_changed_handler (SCPluginIfcfg *plugin,
NMIfcfgConnection *tmp;
GError *error = NULL;
GHashTable *settings;
gboolean new_unmanaged, old_unmanaged;
gboolean new_unmanaged, old_unmanaged, ignore_error = FALSE;
g_return_if_fail (plugin != NULL);
g_return_if_fail (path != NULL);
@ -294,12 +297,16 @@ connection_changed_handler (SCPluginIfcfg *plugin,
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "updating %s", path);
tmp = (NMIfcfgConnection *) nm_ifcfg_connection_new (path, priv->g_connection, priv->hal_mgr, &error);
tmp = (NMIfcfgConnection *) nm_ifcfg_connection_new (path, priv->g_connection,
priv->hal_mgr,
&error,
&ignore_error);
if (!tmp) {
/* couldn't read connection; remove it */
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " error: %s",
error->message ? error->message : "(unknown)");
/* errors reading connection; remove it */
if (!ignore_error) {
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " error: %s",
error->message ? error->message : "(unknown)");
}
g_error_free (error);
PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "removed %s.", path);

View file

@ -938,7 +938,8 @@ NMConnection *
connection_from_file (const char *filename,
gboolean *ignored,
char **keyfile,
GError **error)
GError **error,
gboolean *ignore_error)
{
NMConnection *connection = NULL;
NMSettingConnection *s_con;
@ -983,6 +984,7 @@ connection_from_file (const char *filename,
}
if (!strcmp (device, "lo")) {
*ignore_error = TRUE;
g_set_error (error, ifcfg_plugin_error_quark (), 0,
"Ignoring loopback device config.");
g_free (device);

View file

@ -27,6 +27,7 @@
NMConnection *connection_from_file (const char *filename,
gboolean *ignored,
char **keyfile,
GError **error);
GError **error,
gboolean *ignore_error);
#endif /* __READER_H__ */