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

Vratislav Podzimek vpodzime at redhat.com
Thu Sep 13 11:36:17 UTC 2012


On Wed, 2012-09-12 at 21:21 +0200, Vratislav Podzimek wrote:
> 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)
dump_text.encode("utf-8") should go there and the same few lines below

> +        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:

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list