On Sat, Jun 26, 2010 at 2:35 PM, Thomas A. McGonagle <[email protected]> wrote: > Hey Doug, > Chuck is right the way to model the > ${datacenter::new_york::VARIABLE_NAME} variable is to do the following: > > class datacenter { } > class datacenter::new_york inherits datacenter { > $VARIABLE_NAME = foo > } > Then you can refer to that foo valuable with the fully qualified var > name ${datacenter::new_york::VARIABLE_NAME) > > If you need to find that value in a template you will have to find it > with the scope.lookupvar() erb function. i.e. <%= > scope.lookpvar("datacenter::new_york::VARIABLE_NAME") %> > -Tom
Thanks. Does it have to inherit? I think I've fully qualified the variable in the past an it's worked when I've just used an include directive. A few days ago however, I also got a weird error where puppet said that the variable had not been defined yet, so it couldn't be used (even though it had been defined). I tell ya... variable scoping in puppet it's biggest downfall and pain point imho. Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en.
