diff options
-rw-r--r-- | sos/plugins/__init__.py | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index da5c2f72..0d245013 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -969,20 +969,15 @@ class Plugin(object): self.copy_strings.append((content, filename)) self._log_debug("added string ...'%s' as '%s'" % (summary, filename)) - def get_cmd_output_now(self, exe, suggest_filename=None, - root_symlink=False, timeout=300, stderr=True, - chroot=True, runat=None, env=None, - binary=False, sizelimit=None, pred=None): + def _get_cmd_output_now(self, exe, suggest_filename=None, + root_symlink=False, timeout=300, stderr=True, + chroot=True, runat=None, env=None, + binary=False, sizelimit=None): """Execute a command and save the output to a file for inclusion in the report. """ start = time() - if not self.test_predicate(cmd=True, pred=pred): - self._log_info("skipped cmd output '%s' due to predicate (%s)" % - (exe, self.get_predicate(cmd=True, pred=pred))) - return None - result = self.get_command_output(exe, timeout=timeout, stderr=stderr, chroot=chroot, runat=runat, env=env, binary=binary, @@ -1009,6 +1004,23 @@ class Plugin(object): return os.path.join(self.archive.get_archive_path(), outfn) + def get_cmd_output_now(self, exe, suggest_filename=None, + root_symlink=False, timeout=300, stderr=True, + chroot=True, runat=None, env=None, + binary=False, sizelimit=None, pred=None): + """Execute a command and save the output to a file for inclusion in the + report. + """ + if not self.test_predicate(cmd=True, pred=pred): + self._log_info("skipped cmd output '%s' due to predicate (%s)" % + (exe, self.get_predicate(cmd=True, pred=pred))) + return None + + return self._get_cmd_output_now(exe, timeout=timeout, stderr=stderr, + chroot=chroot, runat=runat, + env=env, binary=binary, + sizelimit=sizelimit) + def is_module_loaded(self, module_name): """Return whether specified moudle as module_name is loaded or not""" if len(grep("^" + module_name + " ", "/proc/modules")) == 0: @@ -1160,11 +1172,12 @@ class Plugin(object): "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s'," + "'%s %s')") % progs[0]) self._log_info("collecting output of '%s'" % prog) - self.get_cmd_output_now(prog, suggest_filename=suggest_filename, - root_symlink=root_symlink, timeout=timeout, - stderr=stderr, chroot=chroot, runat=runat, - env=env, binary=binary, - sizelimit=sizelimit) + self._get_cmd_output_now(prog, suggest_filename=suggest_filename, + root_symlink=root_symlink, + timeout=timeout, stderr=stderr, + chroot=chroot, runat=runat, + env=env, binary=binary, + sizelimit=sizelimit) def _collect_strings(self): for string, file_name in self.copy_strings: |