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

(PUP-10845) Eliminate keyword parameter warning #8467

Merged
merged 1 commit into from Jan 6, 2021

Conversation

joshcooper
Copy link
Contributor

Puppet emitted a deprecation warning when parsing a node definition containing
a hostname, because it passed a hash to Puppet::Parser::AST::HostName.new, but
the initialize method expected keyword arguments. The error is only reproducible
using ruby 2.7.1, but not 2.7.2. The error doesn't happen with AST::Regex,
because its initialize method accepted a hash.

This commit double splats the hash prior to calling klass.new and it updates
AST::Regex to expect keyword arguments like AST::HostName. Note the
superclass AST::Leaf already expects keyword arguments.

Puppet emitted a deprecation warning when parsing a `node` definition containing
a hostname, because it passed a hash to `Puppet::Parser::AST::HostName.new`, but
the initialize method expected keyword arguments. The error is only reproducible
using ruby 2.7.1, but not 2.7.2. The error doesn't happen with `AST::Regex`,
because its `initialize` method accepted a hash.

This commit double splats the hash prior to calling `klass.new` and it updates
`AST::Regex` to expect keyword arguments like `AST::HostName`. Note the
superclass `AST::Leaf` already expects keyword arguments.
@joshcooper joshcooper requested review from a team January 5, 2021 02:25
@joshcooper
Copy link
Contributor Author

I targeted 6.x because we test against 2.7 in CI and that's where the other keyword changes were made.

@joshcooper joshcooper merged commit c798002 into puppetlabs:6.x Jan 6, 2021
@joshcooper joshcooper deleted the ruby27_warning branch January 6, 2021 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants