puppet-jeepyb/manifests/fetch_remotes.pp
Yolanda Robla e331c50cec Add helpers to execute manage_projects
Manage_projects is run in two different ways:
one in a cronjob, one due to subscription. Create
helper classes to isolate that behaviour, to move
logic from system-config.

Change-Id: I4132646446dfe575c333b981aea9a7778c13bcf0
2015-04-20 21:50:46 +01:00

35 lines
753 B
Puppet

# == Class: jeepyb::fetch_remotes
class jeepyb::fetch_remotes(
$ensure = present,
$user = 'gerrit2',
$minute = '*/30',
$logfile = '/var/log/jeepyb_gerritfetchremotes.log',
$log_options = [
'compress',
'missingok',
'rotate 30',
'daily',
'notifempty',
'copytruncate',
],
) {
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'],
}
}