On Wednesday, April 30, 2014 2:43:07 PM UTC-5, Matthew Burgess wrote: > > We just ran into this too recently. From my investigation it looks like > the syntax you quote above is for referencing Hiera values in Puppet > manifests. >
Nope, absolutely not. Templates have visibility into hiera only via the hiera() Puppet function and its kin. > For erb templates we ended up using scope.function_hiera () although I > wonder now whether a scope.lookupvar () call would a) be better and b) be > better as it's more generic? > scope.lookupvar() doesn't do the same thing that scope.function_hiera() does. The former looks up a qualified or unqualified Puppet variable (e.g. a class variable). The latter invokes Puppet's hiera() function to query hiera for data associated with the specified key. Under some circumstances they will return the same value for the same input; under those circumstances, scope.lookupvar() is better because it is cheaper. If you cannot rely on the template being evaluated under those circumstances, however, then you should choose whichever function does the job you actually want. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/194dab71-b4bb-4259-b1ab-925d619de0d2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
