Hi,

On 30/11/2015 11:27, Martin Alfke wrote:

> define modb with an explicit heira lookup and set a default:
> 
> class  ‘modb’ (
>   param => hiera(‘moda::param’, ‘default’)
> ){
>   …
> }
> 
> I am unsure on how to achieve this with data in modules.

Ah, indeed. In fact, with puppet 4, I think I can do this (not tested yet):

class modb (
  $param,
){
  ...
}

And in data.pp

function modb::data () {

  $param_if_set = lookup('moda::param', String, 'unique', undef)
  if $param_if_set == undef {
    $param = ::moda::data()['param']
  } else {
    $param = $param_if_se
  };

    {
      modb::param => $param,
    }

}

I will try a test...

François Lafont

-- 
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/565E7953.8030609%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to