Issue #8032 has been updated by Jeff McCune.
# Slightly less silly #
<pre>
diff --git a/lib/puppet/parser/functions/create_resources.rb
b/lib/puppet/parser/functions/create_resources.rb
index a2b4a25..9e9492a 100644
--- a/lib/puppet/parser/functions/create_resources.rb
+++ b/lib/puppet/parser/functions/create_resources.rb
@@ -28,15 +28,16 @@ Puppet::Parser::Functions::newfunction(:create_resources,
:doc => <<-'ENDHEREDOC
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)
</pre>
----------------------------------------
Bug #8032: create_resources should contain native types in the local scope
https://projects.puppetlabs.com/issues/8032
Author: Jeff McCune
Status: Unreviewed
Priority: Normal
Assignee:
Category: functions
Target version:
Affected Puppet version: 2.7.0rc3
Keywords: create_resources native type graph containment contain
Branch:
# Overview #
As currently implemented, if create_resources is used with a native type, e.g.
group, the resources are not contained within the class container.
For example:
<pre>
class groups {
$groups = { 'one' => { 'ensure' => 'present' } }
create_resources('group', $groups)
}
notify { 'alpha': }
->
class { 'groups': }
->
notify { 'omega': }
</pre>
The graph produced by this manifest should have Group['one'] fully contained
from a relationship perspective within the alpha and omega notifications.
However, the group resource floats off in the graph and relationships do not
hold.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.