-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fixes #37979 - Fix puppet classes import filter when using Ruby 3+ and Regexp/Symbol in YAML file #411
base: master
Are you sure you want to change the base?
Conversation
Is this compatible with older Ruby versions? |
I just amended my commit, this should now be compatible with older Ruby versions. |
@nadjaheitmann Is there is anything I could do to help here? |
@neomilium hi, can you fix the rubocop findings and rebase the branch over the master? This should give us green CI |
@stejskalleos Done. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A difference is that they changed the load_file
method to really be the safe_load_file
method. Sadly on Psych bundled in Ruby 2.7, safe_load_file
doesn't exist.
A way to avoid a specific version check is:
if File.exist?(ignored_file_path)
# Ruby 3+
if YAML.respond_to(:safe_load_file)
YAML.safe_load_file(ignored_file_path, permitted_classes: [Symbol, Regexp])
else
YAML.load_file(ignored_file_path)
end
else
{}
end
Once we drop Ruby 2.7 support, you can drop the load_file
call.
@ekohl Your suggestion is now applied. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit I haven't tested this myself, but I'm approving CI to run.
Updated using `bundle exec rubocop --auto-gen-config`
…bol in YAML file Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
See details here: https://projects.theforeman.org/issues/37979