Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip stub grub.cfg files (e.g. used on Debian OS family). #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/puppetx/augeasproviders_grub/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,21 @@ def self.grub2_cfg_paths
]

valid_paths = paths.map do |path|
begin
real_path = nil

if File.readable?(path) && !File.directory?(path)
real_path = File.realpath(path)
real_path if (File.readable?(real_path) && !File.directory?(real_path))
rescue Errno::ENOENT
nil

# Exclude stub files which include main config (e.g. Debian OS family)
File.foreach(real_path) do |line|
if line.match(/^configfile\s/)
real_path = nil
break
end
end
end

real_path
end.compact.uniq

fail(%{No grub configuration found at '#{paths.join("', '")}'}) if valid_paths.empty?
Expand Down