From c036581dcd6bcd511913f38063bff55b0c5e0b70 Mon Sep 17 00:00:00 2001 From: Greg Langlois Date: Wed, 16 Aug 2023 14:27:35 -0500 Subject: [PATCH 1/2] Drop stderr from mkconfig output --- lib/puppet/provider/grub_config/grub2.rb | 7 ++++++- lib/puppet/provider/grub_menuentry/grub2.rb | 7 ++++++- lib/puppet/provider/grub_user/grub2.rb | 6 +++++- lib/puppet/provider/kernel_parameter/grub2.rb | 7 ++++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/grub_config/grub2.rb b/lib/puppet/provider/grub_config/grub2.rb index 429a618..ec04a5f 100644 --- a/lib/puppet/provider/grub_config/grub2.rb +++ b/lib/puppet/provider/grub_config/grub2.rb @@ -20,7 +20,12 @@ def self.mkconfig_path end confine feature: :augeas - commands mkconfig: mkconfig_path + + confine exists: mkconfig_path, for_binary: true + + def mkconfig + execute(mkconfig_path, { failonfail: true, combine: false }) + end defaultfor osfamily: :RedHat diff --git a/lib/puppet/provider/grub_menuentry/grub2.rb b/lib/puppet/provider/grub_menuentry/grub2.rb index 0b2080f..d7d9786 100644 --- a/lib/puppet/provider/grub_menuentry/grub2.rb +++ b/lib/puppet/provider/grub_menuentry/grub2.rb @@ -250,7 +250,12 @@ def self.prefetch(resources) #### End Class Methods - commands mkconfig: mkconfig_path + confine exists: mkconfig_path, for_binary: true + + def mkconfig + execute(mkconfig_path, { failonfail: true, combine: false }) + end + commands grubby: 'grubby' commands grub_set_default: 'grub2-set-default' diff --git a/lib/puppet/provider/grub_user/grub2.rb b/lib/puppet/provider/grub_user/grub2.rb index 817b2ad..4172cfa 100644 --- a/lib/puppet/provider/grub_user/grub2.rb +++ b/lib/puppet/provider/grub_user/grub2.rb @@ -14,7 +14,11 @@ def self.mkconfig_path which('grub2-mkconfig') or which('grub-mkconfig') or '/usr/sbin/grub-mkconfig' end - commands mkconfig: mkconfig_path + confine exists: mkconfig_path, for_binary: true + + def mkconfig + execute(mkconfig_path, { failonfail: true, combine: false }) + end confine exists: '/etc/grub.d' diff --git a/lib/puppet/provider/kernel_parameter/grub2.rb b/lib/puppet/provider/kernel_parameter/grub2.rb index 94636d6..fb11f6e 100644 --- a/lib/puppet/provider/kernel_parameter/grub2.rb +++ b/lib/puppet/provider/kernel_parameter/grub2.rb @@ -28,7 +28,12 @@ def self.mkconfig_path confine feature: :augeas defaultfor augeasprovider_grub_version: 2 - commands mkconfig: mkconfig_path + + confine exists: mkconfig_path, for_binary: true + + def mkconfig + execute(mkconfig_path, { failonfail: true, combine: false }) + end # when both grub* providers match, prefer GRUB 2 def self.specificity From 810eb25f0a05cfca1923ddee35308787358ae469 Mon Sep 17 00:00:00 2001 From: Greg Langlois Date: Wed, 16 Aug 2023 14:50:24 -0500 Subject: [PATCH 2/2] Fix references to mkconfig_path class method --- lib/puppet/provider/grub_config/grub2.rb | 2 +- lib/puppet/provider/grub_menuentry/grub2.rb | 2 +- lib/puppet/provider/grub_user/grub2.rb | 2 +- lib/puppet/provider/kernel_parameter/grub2.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/grub_config/grub2.rb b/lib/puppet/provider/grub_config/grub2.rb index ec04a5f..6ae30c8 100644 --- a/lib/puppet/provider/grub_config/grub2.rb +++ b/lib/puppet/provider/grub_config/grub2.rb @@ -24,7 +24,7 @@ def self.mkconfig_path confine exists: mkconfig_path, for_binary: true def mkconfig - execute(mkconfig_path, { failonfail: true, combine: false }) + execute(self.class.mkconfig_path, { failonfail: true, combine: false }) end defaultfor osfamily: :RedHat diff --git a/lib/puppet/provider/grub_menuentry/grub2.rb b/lib/puppet/provider/grub_menuentry/grub2.rb index d7d9786..a9797a6 100644 --- a/lib/puppet/provider/grub_menuentry/grub2.rb +++ b/lib/puppet/provider/grub_menuentry/grub2.rb @@ -253,7 +253,7 @@ def self.prefetch(resources) confine exists: mkconfig_path, for_binary: true def mkconfig - execute(mkconfig_path, { failonfail: true, combine: false }) + execute(self.class.mkconfig_path, { failonfail: true, combine: false }) end commands grubby: 'grubby' diff --git a/lib/puppet/provider/grub_user/grub2.rb b/lib/puppet/provider/grub_user/grub2.rb index 4172cfa..01ea87f 100644 --- a/lib/puppet/provider/grub_user/grub2.rb +++ b/lib/puppet/provider/grub_user/grub2.rb @@ -17,7 +17,7 @@ def self.mkconfig_path confine exists: mkconfig_path, for_binary: true def mkconfig - execute(mkconfig_path, { failonfail: true, combine: false }) + execute(self.class.mkconfig_path, { failonfail: true, combine: false }) end confine exists: '/etc/grub.d' diff --git a/lib/puppet/provider/kernel_parameter/grub2.rb b/lib/puppet/provider/kernel_parameter/grub2.rb index fb11f6e..b7d9c25 100644 --- a/lib/puppet/provider/kernel_parameter/grub2.rb +++ b/lib/puppet/provider/kernel_parameter/grub2.rb @@ -32,7 +32,7 @@ def self.mkconfig_path confine exists: mkconfig_path, for_binary: true def mkconfig - execute(mkconfig_path, { failonfail: true, combine: false }) + execute(self.class.mkconfig_path, { failonfail: true, combine: false }) end # when both grub* providers match, prefer GRUB 2