-
Notifications
You must be signed in to change notification settings - Fork 581
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
(PE-20308) Fix defined_with_params() for defined type strings & references #765
Conversation
defined_with_params() now returns false for defined types, causing duplicate resources when using ensure_resources(). Introduced by 4f19c27 in PE-20308.
(PE-20308) Pass a literal type and not a string to findresource
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.
Works well, looks sensible. Thanks.
| @@ -30,6 +30,7 @@ | |||
| if reference.is_a?(String) | |||
| type_name, title = Puppet::Resource.type_and_title(reference, nil) | |||
| type = Puppet::Type.type(type_name) | |||
| type = type_name if type.nil? | |||
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.
Perhaps the best way would be to resolve the type the same way it's resolved in the is_defined function. I.e, replace the two lines with:
type = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(scope, val)
That will ensure some level of consistency. Settling for a string here will cause yet another call to Puppet::Type#type from the Puppet::Resource#resource_type method.
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.
Ah, I never knew how to do this. Thanks!
|
Is this also going into the master branch as well? |
|
Yes this will be merged back into master once we release 4.17.0, which should happen with in the next few days. @buzzdeee thank you for your patience. |
No description provided.