inkblot / puppet-bind

18 stars 82 forks source link

Add local_options (fix #102) #103

Closed disconn3ct closed 8 years ago

disconn3ct commented 8 years ago

Fix for #102. Allows (optional) arbitrary local options hash.

class { 'bind':
  forwarders    => [ '8.8.8.8', ],
  dnssec        => false,
  filter_ipv6   => true,
  local_options => {
    'test_opt'  => 'potato',
    'other_opt' => 'fries',
  }
}
disconn3ct commented 8 years ago

Tested with no local_options and with the example above. In general should probably use validate_hash but there weren't any other validators in init. (It is NBD to add those as well if you want.)

--- /etc/bind/named.conf    2016-09-23 11:20:37.965556276 -0400
+++ /tmp/puppet-file20160923-10621-qefouo   2016-09-23 11:21:20.727391671 -0400
@@ -12,4 +12,6 @@
    listen-on-v6 { any; };
    dnssec-enable no;
    filter-aaaa-on-v4 yes;
+   test_opt potato;
+   other_opt fries;
 };
inkblot commented 8 years ago

I do not like this feature, precisely because some hapless user somewhere could add test_opt potato and other_opt fries to a production bind configuration, have a downed nameserver, and then since DNS is such a core service, have a hell of a time fixing it.

Please add the parameters you would like to use to the class.

disconn3ct commented 8 years ago

Everything is a core service to someone, and bind has quite a few configuration options (many of which should be left defaulted in most cases, rather than explicitly set.) The common usage in other modules is to allow a hash (eg nginx *_cfg_append, which was used in the puppetlabs version even before it was passed around to a bunch of different maintainers.)