aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-08-17 18:31:22 -0400
committerPavel Moravec <pmoravec@redhat.com>2019-08-25 12:42:58 +0200
commitaee752eb016e70ed165c05224d5722b0db07dfb5 (patch)
treedf5cdc0949eea8f51f629bcd05a8aec815136c52
parent8203bdeb77ac0d3f32f1a88304b9a34de66ae7b6 (diff)
downloadsos-aee752eb016e70ed165c05224d5722b0db07dfb5.tar.gz
[Plugin] Apply cmd predicates to add_cmd_output
If no predicate was passed to add_cmd_output() calls, then a predicate set by set_cmd_predicate() was not being applied to those calls, thus leading to a 'None' predicate being evaluated and potentially causing an exception in plugins such as docker where the bulk of command collection is gated by the service running. Now if no predicate is handed to add_cmd_output(), and a cmd_predicate has been set, then the cmd_predicate is applied before being handed off to the _add_cmd_output() helper. Fixes: #1756 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/plugins/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 4e9c4cb4..428b7a0c 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -986,6 +986,8 @@ class Plugin(object):
self._log_warn("ambiguous filename or symlink for command list")
if sizelimit is None:
sizelimit = self.get_option("log_size")
+ if pred is None:
+ pred = self.get_predicate(cmd=True)
for cmd in cmds:
self._add_cmd_output(cmd=cmd, suggest_filename=suggest_filename,
root_symlink=root_symlink, timeout=timeout,