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

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