Skip to content

Conversation

@hunner
Copy link
Contributor

@hunner hunner commented Apr 28, 2017

No description provided.

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
@hunner hunner requested a review from thallgren May 1, 2017 17:33
Copy link
Contributor

@domcleal domcleal left a 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.

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?
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@eputnam eputnam merged commit a4b8688 into puppetlabs:release May 4, 2017
@buzzdeee
Copy link

buzzdeee commented May 5, 2017

Is this also going into the master branch as well?

@tphoney
Copy link
Contributor

tphoney commented May 8, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants