puppet-jeepyb/manifests/fetch_remotes.pp
Colleen Murphy c40bb69d82 Properly escape % in cron command
crontab syntax requires % to be escaped, but puppet complains about '\%'
in strings, so we need to double escape it in puppet. This will result
in a single-escaped % in the crontab.

Change-Id: I2fcb3fca5b2d09e8b0a15036c8d4cbad1a83ba3a
2017-06-14 00:29:15 +02:00

35 lines
758 B
Puppet

# == Class: jeepyb::fetch_remotes
class jeepyb::fetch_remotes(
$ensure = present,
$logfile = '/var/log/jeepyb_gerritfetchremotes.log',
$log_options = [
'compress',
'missingok',
'rotate 30',
'daily',
'notifempty',
'copytruncate',
],
$minute = '*/30',
$user = 'gerrit2',
) {
validate_array($log_options)
include ::jeepyb
cron { 'jeepyb_gerritfetchremotes':
ensure => $ensure,
user => $user,
minute => $minute,
command => "sleep $((RANDOM\\%60+90)) && /usr/local/bin/manage-projects -v >> ${logfile} 2>&1",
}
include ::logrotate
logrotate::file { $logfile:
log => $logfile,
options => $log_options,
require => Cron['jeepyb_gerritfetchremotes'],
}
}