On Fri, Jul 14, 2017, at 18:12, Luke Bigum wrote:
> Hello,
> 
> I've come across an issue with how I want to write profiles vs how a
> module 
> chooses to structure their default data.  As an example, 
> the choria-io/puppet-mcollective module uses hashes of in-module data for 
> each configuration file (which is quite elegant, reduces the amount of 
> templates needed).  My issue with it is how I want to explicitly define 
> some parameters for a profile I'm writing.  If I set a few keys of the 
> 'server_config' hash I end up overwriting the rest of the defaults in the 
> module data, because an explicitly defined class param trumps the entire 
> in-module data hash:
> 
> **************************
>   class { '::mcollective':
>     server        => true,
>     client        => true,
>     server_config => {
>       rpcauditprovider          => 'choria',
>       'plugin.rpcaudit.logfile' =>
>       '/var/log/puppetlabs/choria-audit.log',
>     },
>   }
> **************************
> 
> I've got a solution by calling lookup() to get the original data
> structure, 
> then doing a hash merge in Puppet code:
> 
> **************************
>   $default_data = lookup('mcollective::server_config')
>   $my_data = {
>     rpcauditprovider          => 'choria',
>     'plugin.rpcaudit.logfile' => '/var/log/puppetlabs/choria-audit.log',
>   }
>   class { '::mcollective':
>     server        => true,
>     client        => true,
>     server_config => $default_data + $my_data,
>   }
> **************************
> 
> Would anyone consider that a dumb approach? Are there better ways?

I have not really found a elegant solution, and I think the right way is
to stick this stuff in hiera on the mcollective::server_config key
rather than try and set it via the params.

You're not doing anything programatic about this data, so why not put it
in hiera?

-- 
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/1500049009.3620455.1041075056.1C347BD9%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to