aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2023-03-07 10:10:33 +0100
committerJake Hunsaker <jhunsake@redhat.com>2023-03-07 09:35:49 -0500
commite8dc0e55988b36d0476bcae741652208356f0f07 (patch)
treee1d638a9fdfa79952838fa71427dd7df20259919
parentd7ce4fb34e2ae5ebc543d071509e38b58227aebc (diff)
downloadsos-e8dc0e55988b36d0476bcae741652208356f0f07.tar.gz
[iprconfig] guard whole plugin by sg kmod predicate
Calling any iprconfig command loads 'sg' kernel module. So guard collecting anything from the plugin by that kmod predicate. Resolves: #3159 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/report/plugins/iprconfig.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/sos/report/plugins/iprconfig.py b/sos/report/plugins/iprconfig.py
index 6b4fb895..a304107f 100644
--- a/sos/report/plugins/iprconfig.py
+++ b/sos/report/plugins/iprconfig.py
@@ -9,7 +9,7 @@
# This plugin enables collection of logs for Power systems
import re
-from sos.report.plugins import Plugin, IndependentPlugin
+from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate
class IprConfig(Plugin, IndependentPlugin):
@@ -22,6 +22,13 @@ class IprConfig(Plugin, IndependentPlugin):
def setup(self):
+ show_ioas = self.collect_cmd_output(
+ "iprconfig -c show-ioas",
+ pred=SoSPredicate(self, kmods=['sg'])
+ )
+ if not show_ioas['status'] == 0:
+ return
+
self.add_cmd_output([
"iprconfig -c show-config",
"iprconfig -c show-alt-config",
@@ -35,10 +42,6 @@ class IprConfig(Plugin, IndependentPlugin):
"iprconfig -c dump"
])
- show_ioas = self.collect_cmd_output("iprconfig -c show-ioas")
- if not show_ioas['status'] == 0:
- return
-
devices = []
if show_ioas['output']:
p = re.compile('sg')