From fa4d54931ec26f905271b0ce1451a52006404350 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Fri, 7 Aug 2015 17:38:10 +0200 Subject: [PATCH] Define local gerrit replication and cronjob only once We are moving this functionality to puppet module, so in order to avoid errors, define only these settings here if needed. Change-Id: Ie21642c75ec5f3ccd21528c094ff4d34970e5564 --- modules/openstack_project/manifests/gerrit.pp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index 7978281e7c..e648c5379f 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -399,18 +399,20 @@ class openstack_project::gerrit ( if ($projects_file != 'UNDEF') { if ($replicate_local) { - file { $local_git_dir: - ensure => directory, - owner => 'gerrit2', - require => Class['::gerrit'], - } - cron { 'mirror_repack': - user => 'gerrit2', - weekday => '0', - hour => '4', - minute => '7', - command => "find ${local_git_dir} -type d -name \"*.git\" -print -exec git --git-dir=\"{}\" repack -afd \\;", - environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', + if (!defined(File[$local_git_dir])) { + file { $local_git_dir: + ensure => directory, + owner => 'gerrit2', + require => Class['::gerrit'], + } + cron { 'mirror_repack': + user => 'gerrit2', + weekday => '0', + hour => '4', + minute => '7', + command => "find ${local_git_dir} -type d -name \"*.git\" -print -exec git --git-dir=\"{}\" repack -afd \\;", + environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', + } } }