(PE-20308) Fix defined_with_params() for defined type strings & references#765
Merged
eputnam merged 2 commits intopuppetlabs:releasefrom May 4, 2017
Merged
(PE-20308) Fix defined_with_params() for defined type strings & references#765eputnam merged 2 commits intopuppetlabs:releasefrom
eputnam merged 2 commits intopuppetlabs:releasefrom
Conversation
defined_with_params() now returns false for defined types, causing duplicate resources when using ensure_resources(). Introduced by 4f19c27 in PE-20308.
hunner
referenced
this pull request
Apr 28, 2017
(PE-20308) Pass a literal type and not a string to findresource
domcleal
approved these changes
May 2, 2017
Contributor
domcleal
left a comment
There was a problem hiding this comment.
Works well, looks sensible. Thanks.
thallgren
suggested changes
May 2, 2017
| 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? |
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Ah, I never knew how to do this. Thanks!
|
Is this also going into the master branch as well? |
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.