diff options
author | Thomas Haller <thaller@redhat.com> | 2014-06-20 17:25:01 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-06-20 17:25:01 +0200 |
commit | 0d45284aa7de1f67fcff31e1888054ea5a96870c (patch) | |
tree | 7dc3a5df234e3675f8ab7b06ced8a9e79518b041 | |
parent | 73508704d888d0d83855348b0ca01a2f4d7b2207 (diff) | |
download | NetworkManager-0d45284aa7de1f67fcff31e1888054ea5a96870c.tar.gz |
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>
-rw-r--r-- | src/nm-dispatcher.c | 14 |
1 files 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) |