|
|
44797e |
From 715a047ada1ca9f9420e194306c5b0fe01b5c9f1 Mon Sep 17 00:00:00 2001
|
|
|
44797e |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
44797e |
Date: Thu, 9 Oct 2014 10:24:42 +0200
|
|
|
44797e |
Subject: [ABRT PATCH 68/68] ureport: attach contact email if configured
|
|
|
44797e |
|
|
|
44797e |
Resolves #1150389
|
|
|
44797e |
|
|
|
44797e |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
44797e |
---
|
|
|
44797e |
src/plugins/abrt-action-ureport | 37 ++++++++++++++++++++++++++++++++++---
|
|
|
44797e |
1 file changed, 34 insertions(+), 3 deletions(-)
|
|
|
44797e |
|
|
|
44797e |
diff --git a/src/plugins/abrt-action-ureport b/src/plugins/abrt-action-ureport
|
|
|
44797e |
index e38a92c..48bebef 100755
|
|
|
44797e |
--- a/src/plugins/abrt-action-ureport
|
|
|
44797e |
+++ b/src/plugins/abrt-action-ureport
|
|
|
44797e |
@@ -8,6 +8,7 @@
|
|
|
44797e |
import sys
|
|
|
44797e |
import os
|
|
|
44797e |
import getopt
|
|
|
44797e |
+import augeas
|
|
|
44797e |
|
|
|
44797e |
from report import dd_opendir, DD_FAIL_QUIETLY_ENOENT
|
|
|
44797e |
from reportclient import set_verbosity, error_msg_and_die, error_msg, log1, log
|
|
|
44797e |
@@ -32,12 +33,31 @@ def init_gettext():
|
|
|
44797e |
gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
|
|
|
44797e |
gettext.textdomain(GETTEXT_PROGNAME)
|
|
|
44797e |
|
|
|
44797e |
-def spawn_and_wait(prog):
|
|
|
44797e |
+
|
|
|
44797e |
+def get_augeas(module, file_path):
|
|
|
44797e |
+ """
|
|
|
44797e |
+ A function for efficient configuration of Augeas.
|
|
|
44797e |
+ Augeas modules are placed in /usr/share/augeas/lenses/dist
|
|
|
44797e |
+ """
|
|
|
44797e |
+
|
|
|
44797e |
+ aug_obj = augeas.Augeas(flags=augeas.Augeas.NO_MODL_AUTOLOAD)
|
|
|
44797e |
+ aug_obj.set("/augeas/load/{0}/lens".format(module), "{0}.lns".format(module))
|
|
|
44797e |
+ aug_obj.set("/augeas/load/{0}/incl".format(module), file_path)
|
|
|
44797e |
+ aug_obj.load()
|
|
|
44797e |
+ return aug_obj
|
|
|
44797e |
+
|
|
|
44797e |
+
|
|
|
44797e |
+def spawn_and_wait(prog, args=None):
|
|
|
44797e |
+ if args is None:
|
|
|
44797e |
+ args = [prog]
|
|
|
44797e |
+ else:
|
|
|
44797e |
+ args.insert(0, prog)
|
|
|
44797e |
+
|
|
|
44797e |
try:
|
|
|
44797e |
- return os.spawnlp(os.P_WAIT, prog, prog)
|
|
|
44797e |
+ return os.spawnvpe(os.P_WAIT, prog, args, os.environ)
|
|
|
44797e |
except OSError as err:
|
|
|
44797e |
error_msg(_("Unable to start '%s', error message was: '%s'"),
|
|
|
44797e |
- prog, err)
|
|
|
44797e |
+ " ".join(args), err)
|
|
|
44797e |
return -1
|
|
|
44797e |
|
|
|
44797e |
def try_parse_number(dd, filename):
|
|
|
44797e |
@@ -78,6 +98,7 @@ if __name__ == "__main__":
|
|
|
44797e |
verbose += 1
|
|
|
44797e |
|
|
|
44797e |
set_verbosity(verbose)
|
|
|
44797e |
+ os.environ["ABRT_VERBOSE"] = str(verbose)
|
|
|
44797e |
|
|
|
44797e |
# getcwd might fail if cwd was deleted
|
|
|
44797e |
try:
|
|
|
44797e |
@@ -140,6 +161,16 @@ if __name__ == "__main__":
|
|
|
44797e |
sys.exit(1)
|
|
|
44797e |
dd.save_text("ureports_counter", str(ureports_counter + 1))
|
|
|
44797e |
dd.close()
|
|
|
44797e |
+
|
|
|
44797e |
+ email = os.getenv("uReport_ContactEmail")
|
|
|
44797e |
+ if not email:
|
|
|
44797e |
+ augeas = get_augeas("libreport", "/etc/libreport/plugins/ureport.conf")
|
|
|
44797e |
+ email = augeas.get("/files/etc/libreport/plugins/ureport.conf/ContactEmail")
|
|
|
44797e |
+
|
|
|
44797e |
+ if email:
|
|
|
44797e |
+ log1("Attaching ContactEmail: " + email)
|
|
|
44797e |
+ spawn_and_wait("reporter-ureport", ["-A", "-E"])
|
|
|
44797e |
+
|
|
|
44797e |
sys.exit(exitcode)
|
|
|
44797e |
else:
|
|
|
44797e |
error_msg_and_die(_("reporter-ureport failed with exit code %d" % exitcode))
|
|
|
44797e |
--
|
|
|
44797e |
1.8.3.1
|
|
|
44797e |
|