Doesnt work. ${variable} is being set literally
On Monday, 26 June 2017 18:44:38 UTC+1, Henrik Lindberg wrote:
>
> On 26/06/17 18:33, João Matos wrote:
> > Hi
> >
> > i wanted to had the value to hiera_hash string key from a variable
> >
> > something like:
> >
> > $variable= specific
> > $newvariable = hiera_hash('data::hiera::$variable')
> >
> > is this possible what's the correct syntax?
> >
>
> I think you want to interpolate a value into the string that is the key
> you are looking up. If so, you would do this:
>
> $variable = 'specific'
> $newvariable = hiera_hash("data::hiera::${variable}")
>
>
> Note that if you are on a recent release you want to use the lookup()
> function instead of hiera_hash function (and friends hiera, hiera_array,
> etc).
>
> Best,
> - henrik
>
> >
> > Thanks
> >
> > --
> > 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] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/puppet-users/b07f61bd-c023-4627-959c-b0ef0bc704c8%40googlegroups.com
>
> > <
> https://groups.google.com/d/msgid/puppet-users/b07f61bd-c023-4627-959c-b0ef0bc704c8%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
>
> Visit my Blog "Puppet on the Edge"
> http://puppet-on-the-edge.blogspot.se/
>
>
--
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/899dfdab-5772-4930-80e7-b8af75073e48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.