Example behaviour: In Anaconda, we tell python-meh to grab logs and put them to the bugreport. But they are only appended to the anaconda-tb file. With this patch they would also appear as single attachments of the bugreport. So one file would still contain everything (handy when using scp or something like that), but it would be easier to find any particular (storage, program, ...) log in the bugzilla.
Vratislav Podzimek (1): Add files specified in the Config object as attachments to bugreports
meh/handler.py | 9 +++++++++ 1 file changed, 9 insertions(+)
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) + params[filename] = fobj.read() + except: + #skip files we cannot read + continue + accountManager = report.accountmanager.AccountManager()
signature = report.createPythonUnhandledExceptionSignature(**params)
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 readcontinueaccountManager = report.accountmanager.AccountManager() signature = report.createPythonUnhandledExceptionSignature(**params)
Example behaviour: In Anaconda, we tell python-meh to grab logs and put them to the bugreport. But they are only appended to the anaconda-tb file. With this patch they would also appear as single attachments of the bugreport. So one file would still contain everything (handy when using scp or something like that), but it would be easier to find any particular (storage, program, ...) log in the bugzilla.
Vratislav Podzimek (1): Add files specified in the Config object as attachments to bugreports
meh/handler.py | 9 +++++++++ 1 file changed, 9 insertions(+)
This sounds like reasonable behavior.
- Chris
anaconda-patches@lists.fedorahosted.org