From 0d45284aa7de1f67fcff31e1888054ea5a96870c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 20 Jun 2014 17:25:01 +0200 Subject: [PATCH] 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 --- src/nm-dispatcher.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index c51a6cba00..f955822b4b 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -328,8 +328,18 @@ dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) free_results (results); } else { 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)