Fix cron setup logic

If $site_base_url and $conf are unset, catalog compilation fails
because the cron resource tries to access $conf['cron_key'] and $conf
is not a hash. If $conf is a hash but does not contain the 'cron_key'
key, a cron is created with the command

 wget -O /dev/null -q -t 1 false/cron.php?cron_key=

which is not sensible and will result in failed crons. It only makes
sense to create this cron if $site_base_url and $conf are set, so this
patch checks that they are set before creating the cron resource.

Change-Id: Ib40350e7b3c5c6261812d00a20decd8692acb4bb
This commit is contained in:
Colleen Murphy 2015-10-15 13:24:29 -07:00
parent 2b25312530
commit 32eb6d3284
1 changed files with 10 additions and 8 deletions

View File

@ -282,14 +282,16 @@ class drupal (
# setup cron job
cron { $site_name:
name => "${site_name}.cron",
command => "wget -O /dev/null -q -t 1 ${$site_base_url}/cron.php?cron_key=${$conf['cron_key']}",
user => root,
minute => '*/5',
require => [
Exec["sitedeploy-${site_name}"],
]
if $site_base_url != false and is_hash($conf) {
cron { $site_name:
name => "${site_name}.cron",
command => "wget -O /dev/null -q -t 1 ${$site_base_url}/cron.php?cron_key=${$conf['cron_key']}",
user => root,
minute => '*/5',
require => [
Exec["sitedeploy-${site_name}"],
]
}
}
}