dispatcher: suppress log warning when nm-dispatcher is disabled in systemd

When 'nm-dispatcher' is not running because its systemd service
'NetworkManager-dispatcher.service' is not enabled, any calls to the dispatcher
will fail with an error of typ DBUS_ERROR:DBUS_GERROR_REMOTE_EXCEPTION (32):

  "Unit dbus-org.freedesktop.nm-dispatcher.service failed to load: No such file or directory."

This clutters the logfile with warnings, although the user probably
disabled the service on purpose.

Special case this particular (recurring) failure and downgrade the warning
to debug level.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-06-20 17:25:01 +02:00
parent 73508704d8
commit 0d45284aa7

View File

@@ -328,8 +328,18 @@ dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
free_results (results); free_results (results);
} else { } else {
g_assert (error); g_assert (error);
nm_log_warn (LOGD_DISPATCH, "(%u) failed: (%d) %s",
info->request_id, error->code, error->message); if (!g_error_matches (error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION)) {
nm_log_warn (LOGD_DISPATCH, "(%u) failed to call dispatcher scripts: (%s:%d) %s",
info->request_id, g_quark_to_string (error->domain),
error->code, error->message);
} else if (!dbus_g_error_has_name (error, "org.freedesktop.systemd1.LoadFailed")) {
nm_log_warn (LOGD_DISPATCH, "(%u) failed to call dispatcher scripts: (%s) %s",
info->request_id, dbus_g_error_get_name (error), error->message);
} else {
nm_log_dbg (LOGD_DISPATCH, "(%u) failed to call dispatcher scripts: (%s) %s",
info->request_id, dbus_g_error_get_name (error), error->message);
}
} }
if (info->callback) if (info->callback)