diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp index 1e89e75f40..e9dbc1aab9 100644 --- a/modules/gerrit/manifests/init.pp +++ b/modules/gerrit/manifests/init.pp @@ -42,6 +42,10 @@ # to: # http://tarballs.openstack.org/ci/gerrit-2.3.0.war # Gerrit will be upgraded on the next puppet run. +# replicate_github: +# A boolean enabling replication to github +# replicate_local: +# A boolean enabling local replication for apache acceleration # testmode: # Set this to true to disable cron jobs and replication, # which can interfere with testing. @@ -73,6 +77,9 @@ class gerrit($virtual_hostname=$fqdn, $mysql_password, $mysql_root_password, $email_private_key, + $replicate_github=false, + $replicate_local=true, + $replication_targets=[], $testmode=false ) { @@ -147,15 +154,14 @@ class gerrit($virtual_hostname=$fqdn, # Skip replication if we're in test mode if ($testmode == false) { -# TODO: This file needs to be templated with a boolean around -# enabling replication to github. Also, the local repos need +# TODO: The local repos need # to be managed in here when we get project creation handled file { '/home/gerrit2/review_site/etc/replication.config': owner => 'root', group => 'root', mode => 444, ensure => 'present', - source => 'puppet:///modules/gerrit/replication.config', + content => template('gerrit/replication.config.erb'), replace => 'true', require => File["/home/gerrit2/review_site/etc"] } diff --git a/modules/gerrit/files/replication.config b/modules/gerrit/templates/replication.config.erb similarity index 80% rename from modules/gerrit/files/replication.config rename to modules/gerrit/templates/replication.config.erb index 91b51774fa..51bbfd77e7 100644 --- a/modules/gerrit/files/replication.config +++ b/modules/gerrit/templates/replication.config.erb @@ -1,14 +1,18 @@ # This file is managed by puppet. # https://github.com/openstack/openstack-ci-puppet +<% if replicate_github -%> [remote "github"] url = git@github.com:${name}.git authGroup = Anonymous Users replicatePermissions = false mirror = true +<% end -%> +<% if replicate_local -%> [remote "local"] url = file:///var/lib/git/${name}.git replicationDelay = 0 threads = 4 mirror = true +<% end -%> diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index 4ce1d76eb2..c185db9617 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -85,6 +85,7 @@ class openstack_project::gerrit ( mysql_password => $mysql_password, mysql_root_password => $mysql_root_password, email_private_key => $email_private_key, + replicate_github => true, testmode => $testmode, } if ($testmode == false) {