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?

Thanks,

-Luke

-- 
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/72d9a6f3-0133-4634-bafc-5c84e0109328%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to