Greetings João, Do you have it inside double or single quotes? If it's in single quotes, like your example, then it's only going to be literal. To get interpolation you've got to use double quotes like Henrik had.
-Andy- On 06/27/2017 08:26 AM, João Matos wrote: > 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 puppet-users...@googlegroups.com <javascript:> > > <mailto:puppet-users+unsubscr...@googlegroups.com <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> > > > > > <https://groups.google.com/d/msgid/puppet-users/b07f61bd-c023-4627-959c-b0ef0bc704c8%40googlegroups.com?utm_medium=email&utm_source=footer > > <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 > <https://groups.google.com/d/optout>. > > > -- > > Visit my Blog "Puppet on the Edge" > http://puppet-on-the-edge.blogspot.se/ > <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 puppet-users+unsubscr...@googlegroups.com > <mailto:puppet-users+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/899dfdab-5772-4930-80e7-b8af75073e48%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/899dfdab-5772-4930-80e7-b8af75073e48%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout. -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f02a609d-60e9-cbb4-4e95-0fecf7f5c798%40bardicgrove.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature