I believe you can do

class elements::tfel4::elements {
    include elements::tfel4::jboss
    include elements::tfel4::defaults
    notice("(2)tfel4_ClusterDbType = $
{elements::tfel4::defaults::tfel4_ClusterDbType}")
}


On Jun 20, 2:48 pm, Gabriel Filion <lelu...@gmail.com> wrote:
> On 2010-06-20 14:55, Douglas Garstang wrote:
>
>
>
> > I think I have a misunderstanding of variable scope in classes.
>
> > Wy isn't tfel4_ClusterDbType set in the elements::tfel4::elements
> > class? It's set in elements::tfel4::defaults but then goes *poof* when
> > elements::tfel4::elements tries to access it.
>
> > class elements::tfel4::defaults {
> >     if ( !$tfel4_ClusterDbType ) {
> >         $tfel4_ClusterDbType = "oracle"
> >     }
> >     notice("(1)tfel4_ClusterDbType = ${tfel4_ClusterDbType}")
> > }
>
> > class elements::tfel4::elements {
> >     include elements::tfel4::jboss
> >     include elements::tfel4::defaults
> >     notice("(2)tfel4_ClusterDbType = ${tfel4_ClusterDbType}")
> > }
>
> Each class is able to access the scopes of its parents but not of its
> siblings. so, in the case of the elements::tfel4::defaults class, it
> will see variables from elements::tfel4 , elements, :: (global scope),
> in that order of precendence -- e.g. the global variables being accessed
> only if the variables are not "redefined" or modified in the parents.
>
> so, for your case, the tfel4_ClusterDbType variable could be defined in
> elements::tfel4
>
> --
> Gabriel Filion

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