Last active
December 17, 2015 23:59
-
-
Save jensk/5693370 to your computer and use it in GitHub Desktop.
Hiera boolean issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original class | |
class dnsmasq ( | |
$service_enabled = true, | |
$service_boot = true, | |
$service_managed = true, | |
){ | |
$service_ensure = $service_enabled ? { | |
false => stopped, | |
default => running | |
} | |
} | |
# Adjusted to work with hiera (automatic class paramater lookups) | |
# which doesnt allow for boolean fields like | |
# | |
# dnsmasq::service_enabled = false | |
# | |
# String as potential solution: | |
# | |
# dnsmasq::service_enabled = 'false' | |
# | |
# which would require patching like this: | |
# | |
class dnsmasq ( | |
$service_enabled = true, | |
$service_boot = true, | |
$service_managed = true, | |
){ | |
$service_ensure = str2bool($service_enabled) ? { | |
false => stopped, | |
default => running | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment