aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2019-02-21 12:56:06 +0000
committerBryn M. Reeves <bmr@redhat.com>2019-03-22 17:53:39 +0000
commita5657d2d1a498278790a9ba011e163f762b38c36 (patch)
tree62d306533968e523f692283f44a86823a1e670f2
parentbd3498b72849815b422048614ee9e5e98f90b52c (diff)
downloadsos-a5657d2d1a498278790a9ba011e163f762b38c36.tar.gz
[Plugin] accept predicates in Plugin.get_cmd_output_now()
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 3793edee..2f6ca040 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -906,11 +906,17 @@ class Plugin(object):
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):
+ binary=False, sizelimit=None, pred=None):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
start = time()
+
+ if pred is not None and not pred:
+ self._log_info("skipped cmd output '%s' due to predicate (%s)" %
+ (exe, pred))
+ return None
+
result = self.get_command_output(exe, timeout=timeout, stderr=stderr,
chroot=chroot, runat=runat,
env=env, binary=binary,