diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-03-27 13:27:25 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-03-27 13:28:45 +0100 |
commit | 353135789bc2a5056778bfc4f5167e6dc1efca9c (patch) | |
tree | e028f71fb6f106ed494aed5a98d9b7e192ae4fc4 | |
parent | c20c93e0375ff242512017ca9b2c2903773ada7d (diff) | |
download | sos-353135789bc2a5056778bfc4f5167e6dc1efca9c.tar.gz |
[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.
-rw-r--r-- | sos/sosreport.py | 8 |
1 files 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("</body></html>") 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: |