Blame SOURCES/sos-bz2176086-iprconfig-sg-kmod.patch

c71a15
From e8dc0e55988b36d0476bcae741652208356f0f07 Mon Sep 17 00:00:00 2001
c71a15
From: Pavel Moravec <pmoravec@redhat.com>
c71a15
Date: Tue, 7 Mar 2023 10:10:33 +0100
c71a15
Subject: [PATCH] [iprconfig] guard whole plugin by sg kmod predicate
c71a15
c71a15
Calling any iprconfig command loads 'sg' kernel module. So guard
c71a15
collecting anything from the plugin by that kmod predicate.
c71a15
c71a15
Resolves: #3159
c71a15
c71a15
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
c71a15
---
c71a15
 sos/report/plugins/iprconfig.py | 13 ++++++++-----
c71a15
 1 file changed, 8 insertions(+), 5 deletions(-)
c71a15
c71a15
diff --git a/sos/report/plugins/iprconfig.py b/sos/report/plugins/iprconfig.py
c71a15
index 6b4fb895..a304107f 100644
c71a15
--- a/sos/report/plugins/iprconfig.py
c71a15
+++ b/sos/report/plugins/iprconfig.py
c71a15
@@ -9,7 +9,7 @@
c71a15
 # This plugin enables collection of logs for Power systems
c71a15
 
c71a15
 import re
c71a15
-from sos.report.plugins import Plugin, IndependentPlugin
c71a15
+from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate
c71a15
 
c71a15
 
c71a15
 class IprConfig(Plugin, IndependentPlugin):
c71a15
@@ -22,6 +22,13 @@ class IprConfig(Plugin, IndependentPlugin):
c71a15
 
c71a15
     def setup(self):
c71a15
 
c71a15
+        show_ioas = self.collect_cmd_output(
c71a15
+                "iprconfig -c show-ioas",
c71a15
+                pred=SoSPredicate(self, kmods=['sg'])
c71a15
+        )
c71a15
+        if not show_ioas['status'] == 0:
c71a15
+            return
c71a15
+
c71a15
         self.add_cmd_output([
c71a15
             "iprconfig -c show-config",
c71a15
             "iprconfig -c show-alt-config",
c71a15
@@ -35,10 +42,6 @@ class IprConfig(Plugin, IndependentPlugin):
c71a15
             "iprconfig -c dump"
c71a15
         ])
c71a15
 
c71a15
-        show_ioas = self.collect_cmd_output("iprconfig -c show-ioas")
c71a15
-        if not show_ioas['status'] == 0:
c71a15
-            return
c71a15
-
c71a15
         devices = []
c71a15
         if show_ioas['output']:
c71a15
             p = re.compile('sg')
c71a15
-- 
c71a15
2.39.2
c71a15