From cf44d08343da74da0ca6f151c99c9c093d62dd82 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Fri, 23 Jul 2021 17:48:04 +0200 Subject: [PATCH] Skip stub grub.cfg files (e.g. used on Debian OS family). Replacing these may break OS update mechanisms which only update the main file. --- lib/puppetx/augeasproviders_grub/util.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/puppetx/augeasproviders_grub/util.rb b/lib/puppetx/augeasproviders_grub/util.rb index 6aa5156..784a5cb 100644 --- a/lib/puppetx/augeasproviders_grub/util.rb +++ b/lib/puppetx/augeasproviders_grub/util.rb @@ -152,7 +152,9 @@ def self.grub2_cfg_paths valid_paths = paths.map do |path| begin real_path = File.realpath(path) - real_path if (File.readable?(real_path) && !File.directory?(real_path)) + real_path if (File.readable?(real_path) && !File.directory?(real_path)) && + # Exclude stub files which include main config (e.g. Debian OS family) + (File.foreach(real_path).grep(/^configfile /).none?) rescue Errno::ENOENT nil end