aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2019-08-16 14:13:12 +0100
committerBryn M. Reeves <bmr@redhat.com>2019-08-16 14:17:37 +0100
commit856bddc6fe2f12a23e96401dd11247116a6d7a70 (patch)
tree4e8bd722322d7ffdcf22346074249b72a9a77254
parentc2a2b6579f580baad69dc5b9815a4082c889f3b4 (diff)
downloadsos-856bddc6fe2f12a23e96401dd11247116a6d7a70.tar.gz
[SoSPredicate] override kernel module tests if --allow-system-changes
If the --allow-system-changes option is in effect, bypass checking of kernel modules and allow commands to attempt to auto-load any missing modules when run. Related: #1678 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py5
-rw-r--r--tests/option_tests.py1
-rw-r--r--tests/plugin_tests.py1
3 files changed, 7 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index c550911a..a6adc23f 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -150,6 +150,11 @@ class SoSPredicate(object):
"""Predicate evaluation hook.
"""
pvalue = False
+
+ # Allow loading kernel modules?
+ pvalue |= self._owner.get_option("allow_system_changes")
+
+ # Are kernel modules loaded?
for k in self.kmods:
pvalue |= self._owner.is_module_loaded(k)
diff --git a/tests/option_tests.py b/tests/option_tests.py
index 3912375d..f0587367 100644
--- a/tests/option_tests.py
+++ b/tests/option_tests.py
@@ -10,6 +10,7 @@ class MockOptions(object):
all_logs = False
dry_run = False
log_size = 25
+ allow_system_changes = False
class GlobalOptionTest(unittest.TestCase):
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index 7d36957b..e81575cf 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -94,6 +94,7 @@ class MockOptions(object):
all_logs = False
dry_run = False
log_size = 25
+ allow_system_changes = False
class PluginToolTests(unittest.TestCase):