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

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