diff --git a/manifests/cron.pp b/manifests/cron.pp index bb7ee98..d37875c 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,6 +1,9 @@ # == Class: gerrit::cron # -class gerrit::cron { +class gerrit::cron ( + $replicate_local = true, + $replicate_path = '/opt/lib/git', +) { cron { 'gerrit_repack': user => 'gerrit2', @@ -11,6 +14,18 @@ class gerrit::cron { environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', } + # if local replication is enabled, repack this mirror as well + if $replicate_local { + cron { 'mirror_repack_local': + user => 'gerrit2', + weekday => '0', + hour => '4', + minute => '17', + command => "find ${replicate_path} -type d -name \"*.git\" -print -exec git --git-dir=\"{}\" repack -afd \\;", + environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', + } + } + cron { 'expireoldreviews': ensure => 'absent', user => 'gerrit2', diff --git a/manifests/init.pp b/manifests/init.pp index 8bb3112..5aa1626 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -788,4 +788,12 @@ class gerrit( require => File['/home/gerrit2/review_site/lib'], } } + + # create local replication directory if needed + if $replicate_local { + file { $replicate_path: + ensure => directory, + owner => 'gerrit2', + } + } }