Skip to content

Commit

Permalink
Skip stub grub.cfg files (e.g. used on Debian OS family).
Browse files Browse the repository at this point in the history
Replacing these may break OS update mechanisms which only update
the main file.
  • Loading branch information
olifre committed Jul 23, 2021
1 parent 63c2c4b commit 5bd04fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/puppetx/augeasproviders_grub/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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).inject(0) {|c, line| c+1} > 5)
rescue Errno::ENOENT
nil
end
Expand Down

0 comments on commit 5bd04fa

Please sign in to comment.