From ec3b2e4b0bce960044c9433d0331c133e7fda639 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Wed, 30 Sep 2015 23:43:31 -0400 Subject: fix default value case for $cron_time with the current code it's impossible to use the automatically generated cron time spec since to get there you need to set $cron_time to false, and this one in turn gets converted to an integer. This throws an error. To fix this, we'll base the second timing to be 30mins after the first one. --- manifests/cron/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 82483df..ee2bbca 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -8,7 +8,7 @@ class puppet::cron::base inherits puppet::base { if !$puppet::cron::cron_time { $crontime_interval_minute = fqdn_rand(29) - $crontime_interval_minute2 = inline_template("<%= 30+scope.lookupvar('puppet::cron::cron_time').to_i %>") + $crontime_interval_minute2 = 30 + $crontime_interval_minute $crontime = "${crontime_interval_minute},${crontime_interval_minute2} * * * *" } else { $crontime = $puppet::cron::cron_time -- cgit v1.2.3 From 483e40d410ce495cc4d6ad0265b3a1948b72e493 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Wed, 30 Sep 2015 23:46:07 -0400 Subject: give a default value to $cron_time This'll make it configure the cron job to a 30mins interval randomly displaced within the hour. It's still possible to set $cron_time to a full cron time spec to set run times manually. --- manifests/cron.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/cron.pp b/manifests/cron.pp index c26e079..4ac6cb4 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,6 +1,6 @@ # run puppet agent as cron class puppet::cron( - $cron_time, + $cron_time = false, $stop_service = true, $config = '/etc/puppet/puppet.conf', $config_content = false, -- cgit v1.2.3