aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/__init__.py2
-rw-r--r--sos/plugins/grub2.py12
2 files changed, 11 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 8084dbfb..e75ec82e 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -208,7 +208,7 @@ class SoSPredicate(object):
'''Does 'cmd' output contain string 'output'?'''
if 'cmd' not in cmd_output or 'output' not in cmd_output:
return False
- result = self._owner.get_command_output(cmd_output['cmd'])
+ result = sos_get_command_output(cmd_output['cmd'])
if result['status'] != 0:
return False
for line in result['output'].splitlines():
diff --git a/sos/plugins/grub2.py b/sos/plugins/grub2.py
index 9786de44..0ca6fe09 100644
--- a/sos/plugins/grub2.py
+++ b/sos/plugins/grub2.py
@@ -6,7 +6,8 @@
#
# See the LICENSE file in the source distribution for further information.
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+from sos.plugins import (Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin,
+ SoSPredicate)
class Grub2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
@@ -32,9 +33,16 @@ class Grub2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
self.add_cmd_output("ls -lanR /boot")
# call grub2-mkconfig with GRUB_DISABLE_OS_PROBER=true to prevent
# possible unwanted loading of some kernel modules
+ # further, check if the command supports --no-grubenv-update option
+ # to prevent removing of extra args in $kernel_opts, and (only) if so,
+ # call the command with this argument
env = {}
env['GRUB_DISABLE_OS_PROBER'] = 'true'
- self.add_cmd_output("grub2-mkconfig", env=env)
+ grub_cmd = 'grub2-mkconfig'
+ co = {'cmd': 'grub2-mkconfig --help', 'output': '--no-grubenv-update'}
+ if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=co)):
+ grub_cmd += ' --no-grubenv-update'
+ self.add_cmd_output(grub_cmd, env=env)
def postproc(self):
# the trailing space is required; python treats '_' as whitespace