diff options
| author | Jeff McCune <jeff@puppetlabs.com> | 2011-07-09 15:17:59 -0700 |
|---|---|---|
| committer | Jeff McCune <jeff@puppetlabs.com> | 2011-07-09 15:17:59 -0700 |
| commit | 768a063099c8c855488728da77e8dd165816fa83 (patch) | |
| tree | c8c9b6bfd181769d16c71ae38a67004bb08df85b | |
| parent | 474b6b530aa5a80414740c1733d93e6187199257 (diff) | |
| parent | a126aee16294b183d2c6068b46ad8e394d2d95f8 (diff) | |
| download | puppet-768a063099c8c855488728da77e8dd165816fa83.tar.gz puppet-768a063099c8c855488728da77e8dd165816fa83.tar.xz puppet-768a063099c8c855488728da77e8dd165816fa83.zip | |
Merge pull request #15 from jeffmccune/ticket/master/8032_create_resources_containment
(#8032) Add containment to create_resources
| -rw-r--r-- | lib/puppet/parser/functions/create_resources.rb | 11 |
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) |
