From 353135789bc2a5056778bfc4f5167e6dc1efca9c Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 27 Mar 2017 13:27:25 +0100 Subject: [sosreport] use archive.add_file(FileObj) for HTML and text report Pass the file object in which HTML and text reports have been generated to the archiving class. Since the files received are instances of TempFileUtil files, they will use fdopen and cannot return a valid file name. --- sos/sosreport.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index c4ec7ff9..7a91d4c9 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1358,8 +1358,8 @@ class SoSReport(object): output = PlainTextReport(report).unicode() fd.write(output) fd.flush() - self.archive.add_file(fd.name, dest=os.path.join('sos_reports', - 'sos.txt')) + self.archive.add_file(fd, dest=os.path.join('sos_reports', + 'sos.txt')) except (OSError, IOError) as e: if e.errno in fatal_fs_errors: self.ui_log.error("") @@ -1436,8 +1436,8 @@ class SoSReport(object): rfd.write(html) rfd.write("") rfd.flush() - self.archive.add_file(rfd.name, dest=os.path.join('sos_reports', - 'sos.html')) + self.archive.add_file(rfd, dest=os.path.join('sos_reports', + 'sos.html')) def postproc(self): for plugname, plug in self.loaded_plugins: -- cgit