summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/resource/type.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb
index 85c0979c1..6296d26e5 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -174,12 +174,29 @@ class Puppet::Resource::Type
@name.is_a?(Regexp)
end
+ # MQR TODO:
+ #
+ # The change(s) introduced by the fix for #4270 are mostly silly & should be
+ # removed, though we didn't realize it at the time. If it can be established/
+ # ensured that nodes never call parent_type and that resource_types are always
+ # (as they should be) members of exactly one resource_type_collection the
+ # following method could / should be replaced with:
+ #
+ # def parent_type
+ # @parent_type ||= parent && (
+ # resource_type_collection.find_or_load([name],parent,type.to_sym) ||
+ # fail Puppet::ParseError, "Could not find parent resource type '#{parent}' of type #{type} in #{resource_type_collection.environment}"
+ # )
+ # end
+ #
+ # ...and then the rest of the changes around passing in scope reverted.
+ #
def parent_type(scope = nil)
return nil unless parent
unless @parent_type
raise "Must pass scope to parent_type when called first time" unless scope
- unless @parent_type = scope.environment.known_resource_types.send("find_#{type}", scope.namespaces, parent)
+ unless @parent_type = scope.environment.known_resource_types.send("find_#{type}", [name], parent)
fail Puppet::ParseError, "Could not find parent resource type '#{parent}' of type #{type} in #{scope.environment}"
end
end