Trigger reindex only when secondary index is set.
Gerrit only allows the reindex command to work when there is a secondary index type configured. By default, on this module, the value for the secondary index is `false`. If we execute Gerrit's reindex command while the secondary index is false it will cause an error on `puppet apply`. This change extracts the reindex command into it's own step on the process. The command will only execute if we configured it with a secondary index. Change-Id: Ifac5daec7db6c2452a731f03c69e52afd196b8da Co-Authored-By: Bruno Tavares <btavare@thoughtworks.com>
This commit is contained in:
parent
61b36f09ea
commit
414b66a740
|
@ -557,7 +557,7 @@ class gerrit(
|
|||
# If gerrit.war was just installed, run the Gerrit "init" command.
|
||||
exec { 'gerrit-initial-init':
|
||||
user => 'gerrit2',
|
||||
command => "/usr/bin/java -jar ${gerrit_war} init -d ${gerrit_site} --batch --no-auto-start; /usr/bin/java -jar ${gerrit_war} reindex -d ${gerrit_site}",
|
||||
command => "/usr/bin/java -jar ${gerrit_war} init -d ${gerrit_site} --batch --no-auto-start",
|
||||
subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'],
|
||||
refreshonly => true,
|
||||
require => [Package['openjdk-7-jre-headless'],
|
||||
|
@ -569,21 +569,33 @@ class gerrit(
|
|||
logoutput => true,
|
||||
}
|
||||
|
||||
if ($secondary_index) {
|
||||
exec { 'gerrit-reindex':
|
||||
user => 'gerrit2',
|
||||
command => "/usr/bin/java -jar ${gerrit_war} reindex -d ${gerrit_site}",
|
||||
subscribe => [File['/home/gerrit2/review_site/bin/gerrit.war'],
|
||||
Exec['gerrit-initial-init'],
|
||||
Exec['gerrit-init']],
|
||||
refreshonly => true,
|
||||
logoutput => true,
|
||||
}
|
||||
}
|
||||
|
||||
# If a new gerrit.war was just installed, run the Gerrit "init" command.
|
||||
# Stop is included here because it may not be running or the init
|
||||
# script may not exist, and in those cases, we don't care if it fails.
|
||||
# Running the init script as the gerrit2 user _does_ work.
|
||||
exec { 'gerrit-init':
|
||||
user => 'gerrit2',
|
||||
command => "/etc/init.d/gerrit stop; /usr/bin/java -jar ${gerrit_war} init -d ${gerrit_site} --batch --no-auto-start; /usr/bin/java -jar ${gerrit_war} reindex -d ${gerrit_site}",
|
||||
command => "/etc/init.d/gerrit stop; /usr/bin/java -jar ${gerrit_war} init -d ${gerrit_site} --batch --no-auto-start",
|
||||
subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'],
|
||||
refreshonly => true,
|
||||
require => [Package['openjdk-7-jre-headless'],
|
||||
User['gerrit2'],
|
||||
File['/home/gerrit2/review_site/etc/gerrit.config'],
|
||||
File['/home/gerrit2/review_site/etc/secure.config']],
|
||||
notify => Exec['install-core-plugins'],
|
||||
onlyif => '/usr/bin/test -f /etc/init.d/gerrit',
|
||||
notify => Exec['install-core-plugins'],
|
||||
logoutput => true,
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ class { '::gerrit':
|
|||
ssh_project_rsa_pubkey_contents => file('/tmp/gerrit-ssh-keys/ssh_project_rsa_key.pub'),
|
||||
ssh_replication_rsa_key_contents => file('/tmp/gerrit-ssh-keys/ssh_replication_rsa_key'),
|
||||
ssh_replication_rsa_pubkey_contents => file('/tmp/gerrit-ssh-keys/ssh_replication_rsa_key.pub'),
|
||||
secondary_index => true,
|
||||
secondary_index_type => 'LUCENE',
|
||||
}
|
||||
|
||||
class { '::gerrit::cron': }
|
||||
|
|
Loading…
Reference in New Issue