Hi Francois,
On 30 Nov 2015, at 05:09, Francois Lafont <[email protected]>
wrote:
> Hi,
>
> I'm using Puppet 4 and I'm wondering if this (see below) is possible.
>
> I have 2 Puppet modules, moda and modb. We can imagine that theses modules
> have just one class init.pp. The class ::moda has a parameter "param" with
> the default value defined in the code of "./moda/functions/data.pp". The
> module modb depends on the module moda (the dependency is indicated in
> ./modb/metadata.json) and the class ::modb have the parameter "param" too.
>
> I would like to define the default value of the parameter ::modb::param
> to ensure that it is equal to the value of ::moda::param, ie I would like
> to have this:
>
> a) If the value of ::moda::param is defined in hiera or in environment.conf
> with "moda::param: xxxx", then the default value of ::modb::param is xxxx too.
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.
>
> b) If the value of ::moda::param is not defined at all (in hiera, in
> environment.conf
> etc.), then the default value of ::modb::param is moda::data()['moda::param’].
same pattern, just set the default accordingly.
Best,
Martin
>
> Is there a proper way to do that with Puppet 4?
> Thanks in advance for your help.
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/565BCBE4.9090008%40gmail.com.
> 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/55CA02DC-7CB3-41DE-8BA3-205AD3742783%40gmail.com.
For more options, visit https://groups.google.com/d/optout.