Issue #2309 has been updated by Andrew Parker.

Status changed from Accepted to Rejected

The behavior being described here is because you are trying to take advantage 
of a bug in the puppet language interpreter. The `$a::dirs += " $name"` seems 
to be relying on bug in which `$a::dirs` is getting modified. I think this is 
#9518.
----------------------------------------
Bug #2309: Defined resources are not evaluated immediately which can cause 
ordering problems
https://projects.puppetlabs.com/issues/2309#change-82520

Author: Ohad Levy
Status: Rejected
Priority: Normal
Assignee: 
Category: language
Target version: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to