diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2019-03-22 18:45:12 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-22 18:45:12 +0000 |
commit | e510d1ab93eaf52725e9c9bb7b6e13451253c201 (patch) | |
tree | 8640c688f01553e27fb37a477819d262af7d7820 | |
parent | 7272805a3104e1feb7878fcc9b12e79b7a5edd5f (diff) | |
download | sos-e510d1ab93eaf52725e9c9bb7b6e13451253c201.tar.gz |
[Plugin] ensure the null predicate evaluates to True
A null predicate (one with no set predicates) must always evaluate
to True, or it will block all collection.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 8f1e4e40..6c588a96 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -156,6 +156,10 @@ class SoSPredicate(object): for s in self._services: pvalue |= self._owner.service_is_running(s) + # Null predicate? + if not any([self._kmods, self._services, self._dry_run]): + return True + return pvalue and not self._dry_run def __init__(self, owner, dry_run=False, kmods=[], services=[]): @@ -494,7 +498,7 @@ class Plugin(object): self.archive.add_string(result, srcpath) else: replacements = 0 - except Exception as e: + except OSError as e: # if trying to regexp a nonexisting file, dont log it as an # error to stdout if e.errno == errno.ENOENT: |