aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2019-02-21 12:59:46 +0000
committerBryn M. Reeves <bmr@redhat.com>2019-03-22 17:53:41 +0000
commitf00a9b9ad5d7236c354de0e7b6a60f9a70c70d88 (patch)
treea7e8285187a1a65433fd1f7657171a84e81c1ec4
parenta5657d2d1a498278790a9ba011e163f762b38c36 (diff)
downloadsos-f00a9b9ad5d7236c354de0e7b6a60f9a70c70d88.tar.gz
[Plugin] accept predicates in Plugin.add_copy_spec()
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 2f6ca040..cf8583ce 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -695,11 +695,16 @@ class Plugin(object):
def _add_copy_paths(self, copy_paths):
self.copy_paths.update(copy_paths)
- def add_copy_spec(self, copyspecs, sizelimit=None, tailit=True):
+ def add_copy_spec(self, copyspecs, sizelimit=None, tailit=True, pred=None):
"""Add a file or glob but limit it to sizelimit megabytes. If fname is
a single file the file will be tailed to meet sizelimit. If the first
file in a glob is too large it will be tailed to meet the sizelimit.
"""
+ if pred is not None and not pred:
+ self._log_info("skipped copy spec '%s' due to predicate (%s)" %
+ (copyspecs, pred))
+ return
+
if sizelimit is None:
sizelimit = self.get_option("log_size")