Skip to content

Commit

Permalink
Fix puppet classes import filter when using Ruby >=3.1 and Regexp/Sym…
Browse files Browse the repository at this point in the history
…bol in YAML file
  • Loading branch information
Romuald Conty committed Dec 7, 2024
1 parent 6f8266d commit 944c7f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/services/foreman_puppet/puppet_class_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,13 @@ def ignored_file_path
end

def load_ignored_file
File.exist?(ignored_file_path) ? YAML.load_file(ignored_file_path) : {}
if Psych::VERSION < '4.0.0'
# NOTE: This could be dropped when this gem will require Ruby >=3.1 which is bundled with Psych 4.x
# https://www.ctrl.blog/entry/ruby-psych4.html
File.exist?(ignored_file_path) ? YAML.load_file(ignored_file_path) : {}
else
File.exist?(ignored_file_path) ? YAML.load_file(ignored_file_path, permitted_classes: [Symbol, Regexp]) : {}
end
end

def ignored_file
Expand Down

0 comments on commit 944c7f5

Please sign in to comment.