Blame SOURCES/sos-bz2011534-opacapture-under-allow-system-changes.patch

92cd8f
From 66ebb8256b1326573cbcb2d134545635dfead3bc Mon Sep 17 00:00:00 2001
92cd8f
From: Jose Castillo <jcastillo@redhat.com>
92cd8f
Date: Sun, 29 Aug 2021 15:35:09 +0200
92cd8f
Subject: [PATCH] [omnipath_client] Ensure opacapture runs only with
92cd8f
 allow-system-changes
92cd8f
92cd8f
While omnipath_client plugin is collecting "opacapture",
92cd8f
`depmod -a` command is executed to regenerates some files
92cd8f
under /usr/lib/modules/$kernel.
92cd8f
92cd8f
modules.dep
92cd8f
modules.dep.bin
92cd8f
modules.devname
92cd8f
modules.softdep
92cd8f
modules.symbols
92cd8f
modules.symbols.bin
92cd8f
92cd8f
This patch ensures that the command is only run when
92cd8f
the option --allow-system-changes is used.
92cd8f
92cd8f
Fixes: RHBZ#1998433
92cd8f
92cd8f
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
92cd8f
---
92cd8f
 sos/report/plugins/omnipath_client.py | 9 +++++++--
92cd8f
 1 file changed, 7 insertions(+), 2 deletions(-)
92cd8f
92cd8f
diff --git a/sos/report/plugins/omnipath_client.py b/sos/report/plugins/omnipath_client.py
92cd8f
index 1ec01384..4e988c5c 100644
92cd8f
--- a/sos/report/plugins/omnipath_client.py
92cd8f
+++ b/sos/report/plugins/omnipath_client.py
92cd8f
@@ -45,7 +45,12 @@ class OmnipathClient(Plugin, RedHatPlugin):
92cd8f
         # rather than storing it somewhere under /var/tmp and copying it via
92cd8f
         # add_copy_spec, add it directly to sos_commands/<plugin> dir by
92cd8f
         # building a path argument using self.get_cmd_output_path().
92cd8f
-        self.add_cmd_output("opacapture %s" % join(self.get_cmd_output_path(),
92cd8f
-                                                   "opacapture.tgz"))
92cd8f
+        # This command calls 'depmod -a', so lets make sure we
92cd8f
+        # specified the 'allow-system-changes' option before running it.
92cd8f
+        if self.get_option('allow_system_changes'):
92cd8f
+            self.add_cmd_output("opacapture %s" %
92cd8f
+                                join(self.get_cmd_output_path(),
92cd8f
+                                     "opacapture.tgz"),
92cd8f
+                                changes=True)
92cd8f
 
92cd8f
 # vim: set et ts=4 sw=4 :
92cd8f
-- 
92cd8f
2.31.1
92cd8f