On 2014-15-12 18:57, Guy Matz wrote:
> Hi! I have a parameterized class that accepts a few parameters, one
> of which I would like to use in the retrieval of hiera data, e.g.
> class foo ( $app_user = 'bar' ) {
> file { "/etc/${app_user::etc_dir}":
What do you expect the result to be here, are you trying to do an
indirection to the variable $bar::etc_dir ? (That will not work, it will
interpolate
the value of $app_user::etc_dir irrespective of what the value of the
$app_user parameter is set to. You probably wanted ${app_user}::etc_dir.
> owner => 'root',
> group => 'root',
> mode => '0644
> }
>
> so app_user should get passed to the class, then ${app_user}::etc_dir
> should get resolved by hiera, If I pass in nagios as app_user, then
> nagios::etc_dir should be looked up in hiera. I can't find the right
> combination of curly braces to get this to work. Should it work?
>
You can lookup the key specifically using one of the hiera functions.
This way you can construct the key you want out of the given parameter
and the additional part (::etc_dir).
Regards
- henrik
> Thanks a lot,
> Guy
> --
> 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
> <mailto:
puppet-users...@googlegroups.com>.
> <
https://groups.google.com/d/msgid/puppet-users/CABnTgtXthijC-uSTARE4rVsodat-Qeq5ON-r2ziN3-xDSwKkqg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/