diff --git a/lib/puppet/provider/kernel_parameter/grub2.rb b/lib/puppet/provider/kernel_parameter/grub2.rb index b7d9c25..a3b5046 100644 --- a/lib/puppet/provider/kernel_parameter/grub2.rb +++ b/lib/puppet/provider/kernel_parameter/grub2.rb @@ -31,8 +31,28 @@ def self.mkconfig_path confine exists: mkconfig_path, for_binary: true + # Add BLS specific option to mkconfig command if needed + # + # @return (String) The commandline + def self.mkconfig_cmdline + needs_bls_cmdline = lambda do + os = Facter.value(:os) + return false unless os.is_a?(Hash) + + return false unless os['family'] == 'RedHat' + return false if os['release']['major'].to_i < 9 + return false if os['release']['major'].to_i == 9 && os['release']['minor'].to_i < 3 + + true + end + + cmdline = [mkconfig_path] + cmdline << '--update-bls-cmdline' if needs_bls_cmdline.call + cmdline + end + def mkconfig - execute(self.class.mkconfig_path, { failonfail: true, combine: false }) + execute(self.class.mkconfig_cmdline, { failonfail: true, combine: false }) end # when both grub* providers match, prefer GRUB 2