Ask Your Question

Using hiera without explicit calls

asked 2013-10-17 05:18:26 -0600

deric gravatar image

In some cases I've noticed that it's possible to use hiera whithout being explicitly called (which should be preferred approach). Hiera config:

munin::client::host      : ''

Which will be auto-magically substitiuted here:

class munin::client(
  $host = '*',

This is great. However when I tried it with inheritance it fails:

class fhgfs {
  $mgmtd_host                    = 'localhost'

class fhgfs::meta (
  $mgmtd_host     = $fhgfs::mgmtd_host,
) inherits fhgfs {  ... }

hiera config: fhgfs::mgmtd_host: ''

The value from hiera is never used and always falls back to defaults. What am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-17 06:58:09 -0600

gertvdijk gravatar image

In this case I think you should explicitly call hiera() to get the right key, because the automatic parameter lookup doesn't take class inheritance into account. E.g.:

class fhgfs::meta (
  $mgmtd_host     = hiera('hgfs::mgmtd_host')
) inherits fhgfs {  ... }
edit flag offensive delete link more


Ok, thanks! I want to share some config parameters between few classes, so inheritance it's good for this. That's what I'm using right now:

deric gravatar imagederic ( 2013-10-17 08:02:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-10-17 05:18:26 -0600

Seen: 108 times

Last updated: Oct 17 '13