validate_bool means something else

`validate_bool` validates that the passed value(s) are boolean, not that they
are true. Reformulate the calls to `unless` blocks, and remove the check for
"dynamic implies master" since setting `dynamic` to true is 1) the default and
2) does not cause any change to configuration text or manifest behavior when
the zone is not master.
This commit is contained in:
Nate Riffe 2015-05-15 07:42:52 -05:00
parent 20e50bf43a
commit 9f489dcb6f

View File

@ -22,35 +22,41 @@ define bind::zone (
$cachedir = $::bind::cachedir $cachedir = $::bind::cachedir
$_domain = pick($domain, $name) $_domain = pick($domain, $name)
# dynamic implies master zone unless !($masters != '' and ! member(['slave', 'stub'], $zone_type)) {
validate_bool(!($dynamic and $zone_type != 'master')) fail("masters may only be provided for bind::zone resources with zone_type 'slave' or 'stub'")
}
# masters implies slave/stub zone unless !($transfer_source != '' and ! member(['slave', 'stub'], $zone_type)) {
validate_bool(!($masters != '' and ! member(['slave', 'stub'], $zone_type))) fail("transfer_source may only be provided for bind::zone resources with zone_type 'slave' or 'stub'")
}
# transfer_source implies slave/stub zone unless !($allow_update != '' and ! $dynamic) {
validate_bool(!($transfer_source != '' and ! member(['slave', 'stub'], $zone_type))) fail("allow_update may only be provided for bind::zone resources with dynamic set to true")
}
# allow_updates implies dynamic unless !($dnssec and ! $dynamic) {
validate_bool(!($allow_update != '' and ! $dynamic)) fail("dnssec may only be true for bind::zone resources with dynamic set to true")
}
# dnssec implies dynamic zone unless !($key_directory != '' and ! $dnssec) {
validate_bool(!($dnssec and ! $dynamic)) fail("key_directory may only be provided for bind::zone resources with dnssec set to true")
}
# key_directory implies dnssec unless !($allow_notify != '' and ! member(['slave', 'stub'], $zone_type)) {
validate_bool(!($key_directory != '' and ! $dnssec)) fail("allow_notify may only be provided for bind::zone resources with zone_type 'slave' or 'stub'")
}
# allow_notify implies slave/stub zone unless !($forwarders != '' and $zone_type != 'forward') {
validate_bool(!($allow_notify != '' and ! member(['slave', 'stub'], $zone_type))) fail("forwarders may only be provided for bind::zone resources with zone_type 'forward'")
}
# forwarders implies forward zone unless !($forward != '' and $zone_type != 'forward') {
validate_bool(!($forwarders != '' and $zone_type != 'forward')) fail("forward may only be provided for bind::zone resources with zone_type 'forward'")
}
# forward implies forward zone unless !($source != '' and ! member(['master', 'hint'], $zone_type)) {
validate_bool(!($forward != '' and $zone_type != 'forward')) fail("source may only be provided for bind::zone resources with zone_type 'master' or 'hint'")
}
# source implies master/hint zone
validate_bool(!($source != '' and ! member(['master', 'hint'], $zone_type)))
$zone_file_mode = $zone_type ? { $zone_file_mode = $zone_type ? {
'master' => $dynamic ? { 'master' => $dynamic ? {