aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/archive.py9
-rw-r--r--sos/plugins/__init__.py6
-rw-r--r--sos/plugins/cloudforms.py4
-rw-r--r--sos/plugins/lvm2.py4
-rw-r--r--sos/plugins/rhui.py2
-rw-r--r--sos/plugins/satellite.py3
6 files changed, 21 insertions, 7 deletions
diff --git a/sos/archive.py b/sos/archive.py
index 8e391c3f..1dfea24e 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -59,6 +59,12 @@ class Archive(object):
def add_dir(self, path):
raise NotImplementedError
+ def get_tmp_dir(self):
+ """Return a temporary directory that clients of the archive may
+ use to write content to. The content of the path is guaranteed
+ to be included in the generated archive."""
+ raise NotImplementedError
+
def cleanup(self):
"""Clean up any temporary resources used by an Archive class."""
pass
@@ -136,6 +142,9 @@ class FileCacheArchive(Archive):
def _makedirs(self, path, mode=0700):
os.makedirs(path, mode)
+ def get_tmp_dir(self):
+ return self._archive_root
+
def makedirs(self, path, mode=0700):
self._makedirs(self.dest_path(path))
self.log.debug("created directory at %s in FileCacheArchive %s"
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index c3c2e87a..70711a3e 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -496,6 +496,12 @@ class Plugin(object):
"""Run a program and collect the output"""
self.collect_cmds.append( (exe, suggest_filename, root_symlink, timeout) )
+ def get_cmd_dir(self):
+ """Return a directory into which this module should store
+ collected command output"""
+ return os.path.join(self.archive.get_tmp_dir(),
+ 'sos_commands', self.name())
+
def file_grep(self, regexp, *fnames):
"""Returns lines matched in fnames, where fnames can either be
pathnames to files to grep through or open file objects to grep through
diff --git a/sos/plugins/cloudforms.py b/sos/plugins/cloudforms.py
index 1dc0eae3..d72dc42b 100644
--- a/sos/plugins/cloudforms.py
+++ b/sos/plugins/cloudforms.py
@@ -30,9 +30,9 @@ class Cloudforms(Plugin, RedHatPlugin):
katello_debug = "/usr/share/katello/script/katello-debug"
aeolus_debug = "aeolus-debug"
if os.path.isfile(katello_debug):
- katello_debug_path = os.path.join(self.commons['dstroot'],"katello-debug")
+ katello_debug_path = os.path.join(self.get_cmd_dir(), "katello-debug")
self.add_cmd_output("%s --notar -d %s" % (katello_debug, katello_debug_path))
if os.path.isfile(aeolus_debug):
- aeolus_debug_path = os.path.join(self.commons['dstroot'],"aeolus-debug")
+ aeolus_debug_path = os.path.join(self.get_cmd_dir(), "aeolus-debug")
self.add_cmd_output("%s --notar -d %s" % (aeolus_debug, aeolus_debug_path))
diff --git a/sos/plugins/lvm2.py b/sos/plugins/lvm2.py
index 8fb1843b..4e55f27f 100644
--- a/sos/plugins/lvm2.py
+++ b/sos/plugins/lvm2.py
@@ -29,8 +29,8 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Collects an lvmdump in standard format with optional metadata
archives for each physical volume present.
"""
- cmd = "lvmdump -d '%s'" % os.path.join(self.commons['dstroot'],
- "lvmdump")
+ lvmdump_cmd = "lvmdump -d '%s'"
+ cmd = lvmdump_cmd % os.path.join(self.get_cmd_dir(), "lvmdump")
if self.get_option('lvmdump-a'):
cmd += " -a"
self.add_cmd_output(cmd)
diff --git a/sos/plugins/rhui.py b/sos/plugins/rhui.py
index 69f3f22a..9bf29590 100644
--- a/sos/plugins/rhui.py
+++ b/sos/plugins/rhui.py
@@ -32,7 +32,7 @@ class Rhui(Plugin, RedHatPlugin):
else:
cds = ""
- rhui_debug_dst_path = os.path.join(self.commons['dstroot'],
+ rhui_debug_dst_path = os.path.join(self.get_cmd_dir(),
self.commons['cmddir'], self.name())
try:
os.mkdir(rhui_debug_dst_path)
diff --git a/sos/plugins/satellite.py b/sos/plugins/satellite.py
index b2d3cde3..75c047fc 100644
--- a/sos/plugins/satellite.py
+++ b/sos/plugins/satellite.py
@@ -78,8 +78,7 @@ class Satellite(Plugin, RedHatPlugin):
"/etc/tomcat6/", "/var/log/tomcat6/"])
if os.path.exists("spacewalk-debug"):
self.add_cmd_output("spacewalk-debug --dir %s"
- % os.path.join(self.commons['dstroot'],
- "sos_commands/rhn"))
+ % os.path.join(self.get_cmd_dir()))
if self.proxy:
self.add_copy_specs(["/etc/squid", "/var/log/squid"])