aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/archive.py7
-rw-r--r--sos/sosreport.py12
2 files changed, 14 insertions, 5 deletions
diff --git a/sos/archive.py b/sos/archive.py
index a6394cfc..4838ddd9 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -113,7 +113,7 @@ class Archive(object):
"""Finalize an archive object via method. This may involve creating
An archive that is subsequently compressed or simply closing an
archive that supports in-line handling. If method is automatic then
- the following technologies are tried in order: xz, bz2 and gzip"""
+ the following methods are tried in order: xz, bz2 and gzip"""
self.close()
@@ -222,11 +222,13 @@ class FileCacheArchive(Archive):
shutil.rmtree(self._archive_root)
def finalize(self, method):
- self.log_info("finalizing archive '%s'" % self._archive_root)
+ self.log_info("finalizing archive '%s' using method '%s'"
+ % (self._archive_root, method))
self._build_archive()
self.cleanup()
self.log_info("built archive at '%s' (size=%d)" % (self._archive_name,
os.stat(self._archive_name).st_size))
+ self.method = method
return self._compress()
@@ -301,6 +303,7 @@ class TarFileArchive(FileCacheArchive):
cmd = "%s -1" % cmd
try:
command = shlex.split("%s %s" % (cmd, self.name()))
+ print "%s %s" % (cmd, self.name())
p = Popen(command,
stdout=PIPE,
stderr=PIPE,
diff --git a/sos/sosreport.py b/sos/sosreport.py
index fc7dc527..90890643 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -608,9 +608,6 @@ class SoSReport(object):
return self.tempfile_util.new()
def _set_archive(self):
- if self.opts.compression_type not in ('auto', 'zip', 'bzip2', 'gzip', 'xz'):
- raise Exception("Invalid compression type specified. Options are:" +
- "auto, zip, bzip2, gzip and xz")
archive_name = os.path.join(self.tmpdir,self.policy.get_archive_name())
if self.opts.compression_type == 'auto':
auto_archive = self.policy.get_preferred_archive()
@@ -956,6 +953,15 @@ class SoSReport(object):
self.policy.pre_work()
try:
self.ui_log.info(_(" Setting up archive ..."))
+ compression_methods = ('auto', 'zip', 'bzip2', 'gzip', 'xz')
+ method = self.opts.compression_type
+ if method not in compression_methods:
+ compression_list = ', '.join (compression_methods)
+ self.ui_log.error("")
+ self.ui_log.error("Invalid compression specified: " + method)
+ self.ui_log.error("Valid types are: " + compression_list)
+ self.ui_log.error("")
+ self._exit(1)
self._set_archive()
self._make_archive_paths()
return