Issue #2309 has been updated by Jeff Ollie.
Is this bug being actively worked on? I have a similar situation in which I
need to add a condition to a template based upon what classes are defined for a
host:
<% if classes.include?("asterisk") %>
master agentx
agentXSocket /var/agentx/master
agentXPerms 0660 0550 nobody asterisk
<% end %>
The template lives in the "snmp" module/class and is being evaluated before the
asterisk class is defined, so the template generates incorrect output. I
haven't yet figured out a workaround other than hardcoding a test based upon
$fqdn
----------------------------------------
Bug #2309: Defined resources are not evaluated immediately which can cause
ordering problems
https://projects.puppetlabs.com/issues/2309
Author: Ohad Levy
Status: Accepted
Priority: Normal
Assignee:
Category: language
Target version: 2.7.x
Affected Puppet version: 0.24.8
Keywords:
Branch:
Because defined resources are queued as they're defined, and only evaluated
when all other work is done, we can see ordering issues. In the example below,
the two classes are evaluated to the level of the defined resource, and then
stopped. This results in the variable modification in the defined resource not
getting called until after the template is evaluated.
The correct behaviour should see the defined resource getting evaluated as soon
as it is added to the catalog, rather than queueing it for later.
original description:
it seems that templates ignore variable scopes, consider this code:
<pre>
node default {
include a
include b
}
class a {
$dirs = ""
dir{["/tmp","/tmp/a","/tmp/b"]: before => File["/tmp/dirs"]}
}
class b {
file{"/tmp/dirs": content => $a::dirs}
#file{"/tmp/dirs": content => template("/tmp/dirs.erb")}
}
define dir() {
$a::dirs += " $name"
file {$name: ensure => directory }
}
</pre>
using template the output of the file is "", but when dumping the variable
directly, the content is correct.
--
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.