summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/functions/create_resources.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/puppet/parser/functions/create_resources.rb b/lib/puppet/parser/functions/create_resources.rb
index 430f110b4..3b8bb3543 100644
--- a/lib/puppet/parser/functions/create_resources.rb
+++ b/lib/puppet/parser/functions/create_resources.rb
@@ -27,15 +27,16 @@ Takes two parameters:
args[1].each do |title, params|
raise ArgumentError, 'params should not contain title' if(params['title'])
case type_of_resource
- when :type
- res = resource.hash2resource(params.merge(:title => title))
- catalog.add_resource(res)
- when :define
+ # JJM The only difference between a type and a define is the call to instantiate_resource
+ # for a defined type.
+ when :type, :define
p_resource = Puppet::Parser::Resource.new(type_name, title, :scope => self, :source => resource)
params.merge(:name => title).each do |k,v|
p_resource.set_parameter(k,v)
end
- resource.instantiate_resource(self, p_resource)
+ if type_of_resource == :define then
+ resource.instantiate_resource(self, p_resource)
+ end
compiler.add_resource(self, p_resource)
when :class
klass = find_hostclass(title)