From acf1cf7ffd101e7d4ef3827c5d357c0f995f042f Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Mon, 11 Jan 2016 09:47:16 -0800 Subject: [PATCH] Add data type validation to pe_postgresql_management profile Prior to this commit 3 of the 4 parameters were not validated. After this commit, the parameters are correctly validated. Due to MODULES-2960 $autovacuum_scale_factor is validated as a float but then is converted to a string to pass it to the value attribute of postgresql_conf. --- site/profile/manifests/pe_postgresql_management.pp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/site/profile/manifests/pe_postgresql_management.pp b/site/profile/manifests/pe_postgresql_management.pp index 08b6cb6..fd61376 100644 --- a/site/profile/manifests/pe_postgresql_management.pp +++ b/site/profile/manifests/pe_postgresql_management.pp @@ -1,8 +1,8 @@ class profile::pe_postgresql_management ( - $autovacuum_scale_factor = '.01', - $manage_postgresql_service = true, - $all_in_one_pe_install = true, - Boolean $include_pe_databases_maintenance = true, + Float[0,1] $autovacuum_scale_factor = 0.01, + Boolean $manage_postgresql_service = true, + Boolean $all_in_one_pe_install = true, + Boolean $include_pe_databases_maintenance = true, ) { $postgresql_service_resource_name = 'postgresqld' @@ -25,11 +25,13 @@ class profile::pe_postgresql_management ( } } + #The value attribute of postgresql_conf requires a string despite validating a float above + #https://tickets.puppetlabs.com/browse/MODULES-2960 #http://www.postgresql.org/docs/9.4/static/runtime-config-autovacuum.html postgresql_conf { ['autovacuum_vacuum_scale_factor', 'autovacuum_analyze_scale_factor'] : ensure => present, target => '/opt/puppetlabs/server/data/postgresql/9.4/data/postgresql.conf', - value => $autovacuum_scale_factor, + value => "${autovacuum_scale_factor}", notify => $notify_postgresql_service, }