Move local replication directory and repack to module
In this module we are already asking for replicate_local and local_git_dir parameters, but we are not fully using them. Move local git directory creation and mirror repack to puppet-gerrit module to provide this needed feature. Depends-On: Ie21642c75ec5f3ccd21528c094ff4d34970e5564 Change-Id: I24bb90e9fefa2eb60da65cbf24ab1f3b2be54dd7
This commit is contained in:
parent
6664f2dc37
commit
3c09e6f181
@ -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',
|
||||
|
@ -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',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user