diff options
-rw-r--r-- | sos/policies/__init__.py | 26 | ||||
-rw-r--r-- | sos/sosreport.py | 23 |
2 files changed, 27 insertions, 22 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 46b41e0c..d4bec69e 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -254,26 +254,32 @@ No changes will be made to system configuration. to use""" return "md5" - def display_results(self, final_filename=None): + def display_results(self, final_filename=None, build=False): # make sure a report exists if not final_filename: return False - # store checksum into file - fp = open(final_filename + "." + get_hash_name(), "w") - checksum = self._create_checksum(final_filename) - if checksum: - fp.write(checksum + "\n") - fp.close() - self._print() - self._print(_("Your sosreport has been generated and saved in:\n %s") % final_filename) + + if not build: + # store checksum into file + fp = open(final_filename + "." + get_hash_name(), "w") + checksum = self._create_checksum(final_filename) + if checksum: + fp.write(checksum + "\n") + fp.close() + + self._print(_("Your sosreport has been generated and saved in:\n %s") % final_filename) + else: + checksum = None + self._print(_("sosreport build tree is located at : %s" % final_filename)) + self._print() if checksum: self._print(_("The checksum is: ") + checksum) self._print() - self._print(_("Please send this file to your support representative.")) + self._print(_("Please send this file to your support representative.")) self._print() def upload_results(self, final_filename): diff --git a/sos/sosreport.py b/sos/sosreport.py index f297b670..0076d64d 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -212,6 +212,7 @@ class SoSOptions(object): _usealloptions = False _upload = False _batch = False + _build = False _verbosity = 0 _quiet = False _debug = False @@ -1119,11 +1120,12 @@ class SoSReport(object): raise def final_work(self): - + # this must come before archive creation to ensure that log + # files are closed and cleaned up at exit. + self._finish_logging() # package up the results for the support organization if not self.opts.build: - self.ui_log.info(_("Creating compressed archive...")) - + print _("Creating compressed archive...") # compression could fail for a number of reasons try: final_filename = self.archive.finalize(self.opts.compression_type) @@ -1133,17 +1135,14 @@ class SoSReport(object): else: return False - # automated submission will go here - if not self.opts.upload: - self.policy.display_results(final_filename) - else: - self.policy.upload_results(final_filename) - else: - self.ui_log.info(_("\n sosreport build tree is located at : %s\n" - % self.archive.get_archive_path())) + final_filename = self.archive.get_archive_path() - self._finish_logging() + # automated submission will go here + if not self.opts.upload: + self.policy.display_results(final_filename, build = self.opts.build) + else: + self.policy.upload_results(final_filename) self.tempfile_util.clean() |