I would personally take the route of explicitly looking up the hiera data,
along these lines:

class foo ($app_user = 'bar') {

  $dir = hiera("${app_user}::etc_dir")

  file { "/etc/${dir}":
    ...
  }
}

On Mon, Dec 15, 2014 at 1:24 PM, Dan White <[email protected]> wrote:
>
> It may take a step in the middle like this:
>
> class foo (  $app_user = 'bar' ) {
>
>     $where = "/etc/${app_user::etc_dir}"
>
>     file { $where :
>     owner   => 'root',
>     group   => 'root',
>     mode    => '0644
> }
>
> Good luck.  We are all here to share the info.
>
>
> “Sometimes I think the surest sign that intelligent life exists elsewhere in 
> the universe is that none of it has tried to contact us.”  (Bill Waterson: 
> Calvin & Hobbes)
>
>
> On Dec 15, 2014, at 12:57 PM, Guy Matz <[email protected]> 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}":
>     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?
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CABnTgtXthijC-uSTARE4rVsodat-Qeq5ON-r2ziN3-xDSwKkqg%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CABnTgtXthijC-uSTARE4rVsodat-Qeq5ON-r2ziN3-xDSwKkqg%40mail.gmail.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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/47b49b92-1bce-4a84-809a-924d93f69018%40me.com
> <https://groups.google.com/d/msgid/puppet-users/47b49b92-1bce-4a84-809a-924d93f69018%40me.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALGSqj%2BveHzcWKk-cO-LtRO4JNcyF%3DCEpV4U2Za7uDowaO%3DKLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to