From dd0c28384ee63c01128f25ec1389abc6a74251ee Mon Sep 17 00:00:00 2001 From: Vadym Chepkov Date: Tue, 20 Aug 2024 11:34:56 -0400 Subject: [PATCH] fix: limit scope of update-bls-cmdline to RHEL9 grub2 on Amazon/Fedora is not compatible Co-authored-by: Vadym Chepkov Co-authored-by: Ewoud Kohl van Wijngaarden --- lib/puppet/provider/kernel_parameter/grub2.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/puppet/provider/kernel_parameter/grub2.rb b/lib/puppet/provider/kernel_parameter/grub2.rb index a3b5046..7ea5199 100644 --- a/lib/puppet/provider/kernel_parameter/grub2.rb +++ b/lib/puppet/provider/kernel_parameter/grub2.rb @@ -35,19 +35,12 @@ def self.mkconfig_path # # @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 + os = Facter.value(:os) + needs_bls_cmdline = os.is_a?(Hash) && os['family'] == 'RedHat' && !%w[Amazon Fedora].include?(os['name']) && \ + os['release']['major'].to_i == 9 && os['release']['minor'].to_i >= 3 cmdline = [mkconfig_path] - cmdline << '--update-bls-cmdline' if needs_bls_cmdline.call + cmdline << '--update-bls-cmdline' if needs_bls_cmdline cmdline end