Blame 0018-don-t-break-the-event-run-by-failures-of-abrt-action.patch

69165ba
From e6b19714485e72be99a9fcce62cd3a8a0e95808f Mon Sep 17 00:00:00 2001
69165ba
From: Jakub Filak <jfilak@redhat.com>
69165ba
Date: Fri, 24 Jan 2014 14:26:02 +0100
69165ba
Subject: [ABRT PATCH 18/27] don't break the event run by failures of
69165ba
 abrt-action-notify
69165ba
69165ba
Closes #789
69165ba
Closes rhbz#1057710
69165ba
69165ba
rmarko: add newlines to sys.stderr.write calls
69165ba
69165ba
Signed-off-by: Jakub Filak <jfilak@redhat.com>
69165ba
---
69165ba
 src/daemon/abrt_event.conf     |  2 ++
69165ba
 src/plugins/abrt-action-notify | 48 ++++++++++++++++++++++++------------------
69165ba
 2 files changed, 30 insertions(+), 20 deletions(-)
69165ba
69165ba
diff --git a/src/daemon/abrt_event.conf b/src/daemon/abrt_event.conf
69165ba
index 8a8e862..fe9c3d5 100644
69165ba
--- a/src/daemon/abrt_event.conf
69165ba
+++ b/src/daemon/abrt_event.conf
69165ba
@@ -104,7 +104,9 @@ EVENT=open-gui
69165ba
 # Notify a new crash
69165ba
 EVENT=notify package!=
69165ba
         abrt-action-notify -d $DUMP_DIR
69165ba
+        true # ignore failures because we want to run all 'notify' events
69165ba
 
69165ba
 # Notify a new occurrence of a single crash
69165ba
 EVENT=notify-dup package!=
69165ba
         abrt-action-notify -d $DUMP_DIR
69165ba
+        true # ignore failures because we want to run all 'notify' events
69165ba
diff --git a/src/plugins/abrt-action-notify b/src/plugins/abrt-action-notify
69165ba
index 72bfbf8..cbabf74 100644
69165ba
--- a/src/plugins/abrt-action-notify
69165ba
+++ b/src/plugins/abrt-action-notify
69165ba
@@ -216,17 +216,22 @@ if __name__ == "__main__":
69165ba
                 format(DIR_PATH, ex.message))
69165ba
         sys.exit(RETURN_FAILURE)
69165ba
 
69165ba
+    # The execution must continue because we should try to notify via all
69165ba
+    # configured channels. One of them might work properly.
69165ba
+    return_status = RETURN_OK
69165ba
     try:
69165ba
         emit_crash_dbus_signal(PD)
69165ba
     except RuntimeError as ex:
69165ba
-        sys.stderr.write("Cannot notify '{0}': {1}\n".
69165ba
+        sys.stderr.write("Cannot notify '{0}' via D-Bus: {1}\n".
69165ba
                 format(DIR_PATH, ex.message))
69165ba
-        sys.exit(RETURN_FAILURE)
69165ba
+        return_status = RETURN_FAILURE
69165ba
     except KeyError as ex:
69165ba
         # this is a bug in build_notification_problem_data()
69165ba
         sys.stderr.write("BUG: problem data misses required element '{0}'"
69165ba
-                .format(ex.message))
69165ba
-        sys.exit(RETURN_FAILURE)
69165ba
+                         " required for D-Bus notification\n"
69165ba
+                         .format(ex.message))
69165ba
+
69165ba
+        return_status = RETURN_FAILURE
69165ba
 
69165ba
     if OPTIONS.autoreporting or conf.get("AutoreportingEnabled", "no") == "yes":
69165ba
         event_name = OPTIONS.autoreporting_event
69165ba
@@ -234,20 +239,23 @@ if __name__ == "__main__":
69165ba
             if "AutoreportingEvent" in conf:
69165ba
                 event_name = conf["AutoreportingEvent"]
69165ba
             else:
69165ba
-                sys.stderr.write("Autoreporting event is not configured")
69165ba
-                sys.exit(RETURN_FAILURE)
69165ba
-
69165ba
-        try:
69165ba
-            run_autoreport(PD, event_name)
69165ba
-        except RuntimeError as ex:
69165ba
-            sys.stderr.write("Cannot notify '{0}': {1}\n".
69165ba
-                    format(DIR_PATH, ex.message))
69165ba
-            sys.exit(RETURN_FAILURE)
69165ba
-        except KeyError as ex:
69165ba
-            # this is a bug in build_notification_problem_data()
69165ba
-            sys.stderr.write("BUG: problem data misses required element '{0}'"
69165ba
-                    .format(ex.message))
69165ba
-            sys.exit(RETURN_FAILURE)
69165ba
-
69165ba
-    sys.exit(RETURN_OK)
69165ba
+                sys.stderr.write("Autoreporting event is not configured\n")
69165ba
+                return_status = RETURN_FAILURE
69165ba
+
69165ba
+        if event_name:
69165ba
+            try:
69165ba
+                run_autoreport(PD, event_name)
69165ba
+            except RuntimeError as ex:
69165ba
+                sys.stderr.write("Cannot notify '{0}' via uReport: {1}\n".
69165ba
+                        format(DIR_PATH, ex.message))
69165ba
+                return_status = RETURN_FAILURE
69165ba
+            except KeyError as ex:
69165ba
+                # this is a bug in build_notification_problem_data()
69165ba
+                sys.stderr.write(
69165ba
+                    "BUG: problem data misses required element '{0}'"
69165ba
+                    " required for uReport notification\n".format(ex.message))
69165ba
+
69165ba
+                return_status = RETURN_FAILURE
69165ba
+
69165ba
+    sys.exit(return_status)
69165ba
 
69165ba
-- 
69165ba
1.8.3.1
69165ba