[PATCH 1/2] Fix dumpState to work with the new python-meh (#856235)

Vratislav Podzimek vpodzime at redhat.com
Wed Sep 12 19:21:45 UTC 2012


Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/__init__.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 2ac97c0..311868b 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -188,17 +188,15 @@ class Anaconda(object):
         exn = ReverseExceptionDump((None, None, stack), self.mehConfig)
 
         # dump to a unique file
-        (fd, filename) = mkstemp("", "anaconda-tb-", "/tmp")
-        fo = os.fdopen(fd, "w")
-        exn.write(self, fo)
-        fo.close()
-
-        #append to a given file
-        with open(filename, "r") as f:
-            content = f.readlines()
+        (fd, filename) = mkstemp(prefix="anaconda-tb-", dir="/tmp")
+        dump_text = exn.traceback_and_object_dump(self)
+        os.write(fd, dump_text)
+        os.close(fd)
+
+        # append to a given file
         with open("/tmp/anaconda-tb-all.log", "a+") as f:
             f.write("--- traceback: %s ---\n" % filename)
-            f.writelines(content)
+            f.write(dump_text + "\n")
 
     def initInterface(self):
         if self._intf:
-- 
1.7.11.4



More information about the anaconda-patches mailing list