Skip to content

re-add support for loading aliases in yaml files #1362

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

Merged

Conversation

lollipopman
Copy link
Contributor

Ruby 3.1 includes Psych 4.0 which no longer loads aliases by default. Since aliases are part of the yaml spec, it seems sensible to re-add support.

@puppet-community-rangefinder
Copy link

loadyaml is a function

Breaking changes to this file MAY impact these 2 modules (near match):

This module is declared in 318 of 580 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Copy link
Collaborator

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Can you please fix the style issues spotted by rubocop and visible on the "Files changed" tab?

Copy link
Collaborator

@b4ldr b4ldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 lgtm once rubocop fixed

@lollipopman lollipopman force-pushed the readd-support-for-loading-aliases branch from 484e386 to e8acae9 Compare May 31, 2023 14:16
@lollipopman
Copy link
Contributor Author

Thanks for reviewing @smortex & @b4ldr bundle exec rake rubocop now passes clean on my pushed branch.

@b4ldr b4ldr force-pushed the readd-support-for-loading-aliases branch from e8acae9 to 783a5ef Compare May 31, 2023 16:29
Ruby 3.1 includes Psych 4.0 which no longer loads aliases by default.
Since aliases are part of the yaml spec, it seems sensible to re-add
support.

We need to read the file first to be compatible with ruby2.7 which does
not support the aliases option on YAML.load_file. Use temp files in
rspec tests to avoid needing to mock read.
@lollipopman lollipopman force-pushed the readd-support-for-loading-aliases branch from 783a5ef to c118a50 Compare May 31, 2023 19:15
@b4ldr b4ldr merged commit 2c816ed into puppetlabs:main Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants