Issue #4778 has been updated by Paul Berry.

Subject changed from Parameterized classes and scope to Evaluation of classes 
instantiated using parameterized style shouldn't be deferred

I've done some more investigation into this.  What's happening is that when 
instantiating a class using "include", the contents of the class are evaluated 
immediately, but when instantiating a class using the new "class { foo: }" 
style, evaluation is deferred until later.  This is why, in Markus's example, 
the variable reference "$a::x" inside class b doesn't work: class a hasn't been 
evaluated yet, even though it seems reasonable that it should be.

In the long term it would be nice if order dependencies like these could be 
eliminated from the language.  But in the short term I think the best solution 
is to ensure that the "class { foo: }" style of class instantiation causes 
evaluation to occur in the same order as "include foo".
----------------------------------------
Bug #4778: Evaluation of classes instantiated using parameterized style 
shouldn't be deferred
http://projects.puppetlabs.com/issues/4778

Author: R.I. Pienaar aka Volcane
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 2.6.x
Affected version: 2.6.1
Keywords: 
Branch: 


Given the manifest:

<pre>
stage{"bootstrap": before => Stage["main"]}


class setup {
    $something = "this"
}

class foo {
    notify{"${setup::something}": }
}
</pre>

The following includes work:

<pre>
include setup
include foo

notice: /Stage[main]/Foo/Notify[this]/message: defined 'message' as 'this'
</pre>

However if I put the setup in the bootstrap stage it doesnt:

<pre>
class{"setup": stage => "bootstrap"}
include foo

warning: Scope(Class[Foo]): Could not look up qualified variable 
'setup::something'; class setup has not been evaluated
notice: 
notice: /Stage[main]/Foo/Notify[]/message: defined 'message' as ''
No title provided and "Notify[]" is not a valid resource reference
</pre>

I'd expect this to work


-- 
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.

Reply via email to