[PATCH] Add files specified in the Config object as attachments to bugreports

Vratislav Podzimek vpodzime at redhat.com
Thu Jul 19 11:53:35 UTC 2012


On Thu, 2012-07-19 at 13:35 +0200, Vratislav Podzimek wrote:
> We append the contents of the files specified in the Config object
> to the program-name-tb-XXXXX file, but with this patch, they will
> also appear as attachments of the bugreport.
> ---
>  meh/handler.py |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meh/handler.py b/meh/handler.py
> index befbcf8..9df098c 100644
> --- a/meh/handler.py
> +++ b/meh/handler.py
> @@ -215,6 +215,15 @@ class ExceptionHandler(object):
>          tb_item_name = "%s-tb" % self.conf.programName
>          params[tb_item_name] = self.exnText
>  
> +        for fpath in self.conf.fileList:
> +            try:
> +                with open(fpath, "r") as fobj:
> +                    filename = os.path.basename(fpath)
Full path should probably go there. I have just noticed that we have for
example /var/log/messages there too.

> +                    params[filename] = fobj.read()
> +            except:
> +                #skip files we cannot read
> +                continue
> +
>          accountManager = report.accountmanager.AccountManager()
>  
>          signature = report.createPythonUnhandledExceptionSignature(**params)




More information about the anaconda-patches mailing list