From e8dc0e55988b36d0476bcae741652208356f0f07 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Tue, 7 Mar 2023 10:10:33 +0100 Subject: [PATCH] [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 --- sos/report/plugins/iprconfig.py | 13 ++++++++----- 1 file 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') -- 2.39.2