Use str2bool for backwards compatibility, and avoid changing puppetdb_service_status

is_pe being a fact, its smarter her to coerce the value of it too a boolean, in
case we still receive the value as a string. In the future structured facts
will become the norm.

I've also removed the patch against the values for puppetdb_service_status, matching
against a bareword boolean while it looks good, if the value is indeed a boolean the
in will fail in the current parser. This can be brought up again in the future.

Signed-off-by: Ken Barber <ken@bob.sh>
This commit is contained in:
Ken Barber 2014-09-15 22:25:26 +01:00
parent 9d607f55f3
commit 8ce1856222
3 changed files with 3 additions and 3 deletions

View file

@ -75,7 +75,7 @@ class puppetdb(
validate_re ($report_ttl_real, ['^\d+(d|h|m|s|ms)$'], "report_ttl is <${report_ttl}> which does not match the regex validation")
# Validate puppetdb_service_status
if !($puppetdb_service_status in [true, 'running', false, 'stopped']) {
if !($puppetdb_service_status in ['true', 'running', 'false', 'stopped']) {
fail("puppetdb_service_status valid values are 'true', 'running', 'false', and 'stopped'. You provided '${puppetdb_service_status}'")
}

View file

@ -65,7 +65,7 @@ class puppetdb::params {
}
}
if defined('$::is_pe') and $::is_pe == true {
if defined('$::is_pe') and str2bool($::is_pe) == true {
$puppetdb_package = 'pe-puppetdb'
$puppetdb_service = 'pe-puppetdb'
$confdir = '/etc/puppetlabs/puppetdb/conf.d'

View file

@ -74,7 +74,7 @@ class puppetdb::server(
validate_re ($report_ttl_real, ['^\d+(d|h|m|s|ms)$'], "report_ttl is <${report_ttl}> which does not match the regex validation")
# Validate puppetdb_service_status
if !($puppetdb_service_status in [true, 'running', false, 'stopped']) {
if !($puppetdb_service_status in ['true', 'running', 'false', 'stopped']) {
fail("puppetdb_service_status valid values are 'true', 'running', 'false', and 'stopped'. You provided '${puppetdb_service_status}'")
}