aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/archive.py11
-rw-r--r--sos/sosreport.py6
2 files changed, 11 insertions, 6 deletions
diff --git a/sos/archive.py b/sos/archive.py
index ae57eb14..931554d1 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -271,7 +271,8 @@ class FileCacheArchive(Archive):
return codecs.open(path, "r", encoding='utf-8')
def cleanup(self):
- shutil.rmtree(self._archive_root)
+ if os.path.isdir(self._archive_root):
+ shutil.rmtree(self._archive_root)
def finalize(self, method):
self.log_info("finalizing archive '%s' using method '%s'"
@@ -445,11 +446,13 @@ class TarFileArchive(FileCacheArchive):
if cmd != "gzip":
cmd = "%s -1" % cmd
try:
- r = sos_get_command_output("%s %s" % (cmd, self.name()),
- timeout=0)
+ exec_cmd = "%s %s" % (cmd, self.name())
+ r = sos_get_command_output(exec_cmd, stderr=True, timeout=0)
if r['status']:
- self.log_info(r['output'])
+ self.log_error(r['output'])
+ raise Exception("%s exited with %s" % (exec_cmd,
+ r['status']))
self._suffix += suffix
return self.name()
diff --git a/sos/sosreport.py b/sos/sosreport.py
index fa37b9cc..028571c9 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -1501,7 +1501,10 @@ class SoSReport(object):
# compute and store the archive checksum
hash_name = self.policy.get_preferred_hash_name()
checksum = self._create_checksum(archive, hash_name)
- self._write_checksum(archive, hash_name, checksum)
+ try:
+ self._write_checksum(archive, hash_name, checksum)
+ except (OSError, IOError):
+ print(_("Error writing checksum for file: %s" % archive))
# output filename is in the private tmpdir - move it to the
# containing directory.
@@ -1534,7 +1537,6 @@ class SoSReport(object):
os.rename(archive_hash, final_hash)
except (OSError, IOError):
print(_("Error moving checksum file: %s" % archive_hash))
- return False
self.policy.display_results(archive, directory, checksum)