[PATCH 1/6] use a dictionary to pass args to report.createPythonUnhandledExceptionSignature and pass environment info this way

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(cherry-picked from ad178a242d350cbccb687135677143e8fc0e574c)
---
 meh/dump.py    |   47 ++++++++++++++++++++++++++---------------------
 meh/handler.py |   16 +++++++++-------
 2 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/meh/dump.py b/meh/dump.py
index fe04766..66594d5 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -66,19 +66,20 @@ class ExceptionDump(object):
         else:
             return ""
 
-    def _environment_info(self):
+    def _get_environment_info(self):
         """
-        Returns string containing ABRT-like header for the bugreport including:
-
-        architecture:
-        cmdline:
-        component:
-        executable:
-        kernel:
-        package:
-        release:
-        other involved packages:
-
+        Returns dictionary containing these items for a bugreport header
+
+        architecture
+        cmdline
+        component
+        executable
+        kernel
+        package
+        release
+        other involved packages
+
+        @rtype: dict (string -> string)
         """
 
         RELEASE_NAME_FILE = "/etc/system-release"
@@ -190,18 +191,23 @@ class ExceptionDump(object):
         release_ver = get_release_version()
         other_packages = ", ".join(get_other_packages(self))
 
-        ret = "architecture: {0}\n".format(os.uname()[4])
-        ret += "cmdline: {0}{1} {2}\n".format(sys.executable,
+        ret = dict()
+        ret["architecture"] = os.uname()[4]
+        ret["cmdline"] = "{0} {1} {2}".format(sys.executable,
                     " ".join(get_python_opts()), sys.argv[0])
-        ret += "component: {0}\n".format(component)
-        ret += "executable: {0}\n".format(sys.argv[0])
-        ret += "kernel: {0}\n".format(os.uname()[2])
-        ret += "package: {0}\n".format(package)
-        ret += "release: {0}\n".format(get_release_version())
-        ret += "other involved packages: {0}\n\n".format(other_packages)
+        ret["component"] = component
+        ret["executable"] = sys.argv[0]
+        ret["kernel"] = os.uname()[2]
+        ret["package"] = package
+        ret["release"] = get_release_version()
+        ret["other involved packages"] = other_packages
 
         return ret
 
+    @property
+    def environment_info(self):
+        return self._get_environment_info()
+
     def __str__(self):
         lst = self._format_stack()
 
@@ -412,7 +418,6 @@ class ExceptionDump(object):
            obj -- Any Python object.  This object will have all its attributes
                   written out, except for those mentioned in the attrSkipList.
         """
-        fd.write(self._environment_info())
         ret = str(self)
         fd.write(ret)
         self.dump(fd, obj)
diff --git a/meh/handler.py b/meh/handler.py
index 1ed1fc1..c4f3f8a 100644
--- a/meh/handler.py
+++ b/meh/handler.py
@@ -195,16 +195,18 @@ class ExceptionHandler(object):
            be overridden by a subclass, but that's going to be a lot of work.
         """
 
-        summary = self.exn.desc
-        exnFileName = self.exnFile
-        description = "The following was filed automatically by %s:\n%s" % (self.conf.programName, str(self.exn))
+        params = dict()
+        params.update(self.exn.environment_info)
+        params["hashmarkername"] = self.conf.programName
+        params["duphash"] = self.exn.hash
+        params["reason"] = self.exn.desc
+        params["description"] = "The following was filed automatically by %s:\n%s" \
+                                    % (self.conf.programName, str(self.exn))
+        params["exnFileName"] = self.exnFile
 
         accountManager = report.accountmanager.AccountManager()
 
-        signature = report.createPythonUnhandledExceptionSignature( \
-            self.conf.programName,
-            self.conf.programName, self.exn.hash,
-            summary, description, exnFileName)
+        signature = report.createPythonUnhandledExceptionSignature(**params)
 
         # We don't want to automatically quit here since the user may wish to
         # save somewhere else, debug, etc.
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux