puppet-r10k icon indicating copy to clipboard operation
puppet-r10k copied to clipboard

Provide ability to override individual webhook settings

Open adoom42 opened this issue 1 year ago • 0 comments
trafficstars

I want to change the default_branch r10k setting in the webhook config. Because the class parameter is a hash, I have to provide a complete hash when calling the class, even when I only want to alter one value. This seems duplicative. It also increases the chance that I'll have to go back and manually update Hiera if the forge module adds, removes, or changes a parameter that I'm not concerned with.

From manifests/webhook.pp:

  R10k::Webhook::Config::R10k $r10k = {
    command_path    => '/opt/puppetlabs/puppet/bin/r10k',
    config_path     => '/etc/puppetlabs/r10k/r10k.yaml',
    default_branch  => 'production',
    prefix          => undef,
    allow_uppercase => false,
    verbose         => true,
    deploy_modules  => true,
    generate_types  => true,
  },

So instead of adding this to my Hiera config:

r10k::webhook::r10k:
  default_branch: 'mybranch'

I have to add this:

r10k::webhook::r10k:
  command_path: '/opt/puppetlabs/puppet/bin/r10k'
  config_path: '/etc/puppetlabs/r10k/r10k.yaml'
  default_branch: 'mybranch'
  prefix: undef
  allow_uppercase: false
  verbose: true
  deploy_modules: true
  generate_types: true

If I don't, those settings get excluded from the config file.

Am I missing something? Is there another way to do this cleanly? If not, please change the class parameters to be individual rather than grouping them into hashes.

adoom42 avatar Jun 20 '24 14:06 adoom42