Darren,

On Tue, Sep 28, 2010 at 11:01 AM, Darren Worrall <iwebdar...@gmail.com>wrote:

> With a manifest like so:
>
> class base {
>  $myvar = '1234'
>  file {
>    '/tmp/foo':
>      content => template('test.erb')
>  }
> }
>
> class newbase inherits base {
>  $myvar = '5678'
> }
>
> node default {
>  include newbase
> }
>
> And test.erb with <%= myvar %>
>
> /tmp/foo contains 1234, when I would expect it to contain 5678.
>
> Is this a bug, or a limitation of class inheritance? (ie, base classes
> are evaluated completely, and subclasses are only allowed to modify
> things after the fact?)
>
> Cheers :)
>

Is the way scoping works, you can take more complete explanation here
http://projects.puppetlabs.com/projects/puppet/wiki/Frequently_Asked_Questions#Class+Inheritance+and+Variable+Scope

Basically the value of the inner scope is the one being used and not
overridden as one might expect.


> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>


-- 
Tony
http://blog.tonyskapunk.net

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to