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

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