Blob Blame History Raw
From 66ebb8256b1326573cbcb2d134545635dfead3bc Mon Sep 17 00:00:00 2001
From: Jose Castillo <jcastillo@redhat.com>
Date: Sun, 29 Aug 2021 15:35:09 +0200
Subject: [PATCH] [omnipath_client] Ensure opacapture runs only with
 allow-system-changes

While omnipath_client plugin is collecting "opacapture",
`depmod -a` command is executed to regenerates some files
under /usr/lib/modules/$kernel.

modules.dep
modules.dep.bin
modules.devname
modules.softdep
modules.symbols
modules.symbols.bin

This patch ensures that the command is only run when
the option --allow-system-changes is used.

Fixes: RHBZ#1998433

Signed-off-by: Jose Castillo <jcastillo@redhat.com>
---
 sos/report/plugins/omnipath_client.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sos/report/plugins/omnipath_client.py b/sos/report/plugins/omnipath_client.py
index 1ec01384..4e988c5c 100644
--- a/sos/report/plugins/omnipath_client.py
+++ b/sos/report/plugins/omnipath_client.py
@@ -45,7 +45,12 @@ class OmnipathClient(Plugin, RedHatPlugin):
         # rather than storing it somewhere under /var/tmp and copying it via
         # add_copy_spec, add it directly to sos_commands/<plugin> dir by
         # building a path argument using self.get_cmd_output_path().
-        self.add_cmd_output("opacapture %s" % join(self.get_cmd_output_path(),
-                                                   "opacapture.tgz"))
+        # This command calls 'depmod -a', so lets make sure we
+        # specified the 'allow-system-changes' option before running it.
+        if self.get_option('allow_system_changes'):
+            self.add_cmd_output("opacapture %s" %
+                                join(self.get_cmd_output_path(),
+                                     "opacapture.tgz"),
+                                changes=True)
 
 # vim: set et ts=4 sw=4 :
-- 
2.31.1