Added an option to toggle replication choices.

New options for github replication and local replication.

Change-Id: I06a6ca5347232ec80e26f6116742ab0007435ffe
This commit is contained in:
Monty Taylor 2012-07-28 11:47:32 -05:00
parent d20c4523bf
commit 0b921968d1
3 changed files with 14 additions and 3 deletions

View File

@ -42,6 +42,10 @@
# to: # to:
# http://tarballs.openstack.org/ci/gerrit-2.3.0.war # http://tarballs.openstack.org/ci/gerrit-2.3.0.war
# Gerrit will be upgraded on the next puppet run. # 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: # testmode:
# Set this to true to disable cron jobs and replication, # Set this to true to disable cron jobs and replication,
# which can interfere with testing. # which can interfere with testing.
@ -73,6 +77,9 @@ class gerrit($virtual_hostname=$fqdn,
$mysql_password, $mysql_password,
$mysql_root_password, $mysql_root_password,
$email_private_key, $email_private_key,
$replicate_github=false,
$replicate_local=true,
$replication_targets=[],
$testmode=false $testmode=false
) { ) {
@ -147,15 +154,14 @@ class gerrit($virtual_hostname=$fqdn,
# Skip replication if we're in test mode # Skip replication if we're in test mode
if ($testmode == false) { if ($testmode == false) {
# TODO: This file needs to be templated with a boolean around # TODO: The local repos need
# enabling replication to github. Also, the local repos need
# to be managed in here when we get project creation handled # to be managed in here when we get project creation handled
file { '/home/gerrit2/review_site/etc/replication.config': file { '/home/gerrit2/review_site/etc/replication.config':
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => 444, mode => 444,
ensure => 'present', ensure => 'present',
source => 'puppet:///modules/gerrit/replication.config', content => template('gerrit/replication.config.erb'),
replace => 'true', replace => 'true',
require => File["/home/gerrit2/review_site/etc"] require => File["/home/gerrit2/review_site/etc"]
} }

View File

@ -1,14 +1,18 @@
# This file is managed by puppet. # This file is managed by puppet.
# https://github.com/openstack/openstack-ci-puppet # https://github.com/openstack/openstack-ci-puppet
<% if replicate_github -%>
[remote "github"] [remote "github"]
url = git@github.com:${name}.git url = git@github.com:${name}.git
authGroup = Anonymous Users authGroup = Anonymous Users
replicatePermissions = false replicatePermissions = false
mirror = true mirror = true
<% end -%>
<% if replicate_local -%>
[remote "local"] [remote "local"]
url = file:///var/lib/git/${name}.git url = file:///var/lib/git/${name}.git
replicationDelay = 0 replicationDelay = 0
threads = 4 threads = 4
mirror = true mirror = true
<% end -%>

View File

@ -85,6 +85,7 @@ class openstack_project::gerrit (
mysql_password => $mysql_password, mysql_password => $mysql_password,
mysql_root_password => $mysql_root_password, mysql_root_password => $mysql_root_password,
email_private_key => $email_private_key, email_private_key => $email_private_key,
replicate_github => true,
testmode => $testmode, testmode => $testmode,
} }
if ($testmode == false) { if ($testmode == false) {