Create index on fresh install

A fresh install of gerrit was refusing to start with

  com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1) No index versions ready; run Reindex

Because we pre-populate some of the directories in review_site, gerrit
init thinks it is in an upgrade situation and does not create or touch
the index.  Thus manually create the index when we are initalising a
new site.

Also, the gerrit-reindex doesn't have to subscribe to the
gerrit-initial-init; it should only be triggered on updates if
offline-indexing is wanted/required.

Change-Id: I98ce9ff87570a86e9b58b38d0605313ee5ee2758
This commit is contained in:
Ian Wienand 2016-08-24 18:25:59 +10:00
parent bcdac6b7a3
commit 5c44d09dc7
1 changed files with 15 additions and 1 deletions

View File

@ -720,13 +720,27 @@ class gerrit(
unless => '/usr/bin/test -f /etc/init.d/gerrit',
logoutput => true,
}
# We need to make the initial index for a fresh install. By default
# the gerrit init call will do that, but because we have
# pre-populated various directories above, even a fresh install
# looks like an upgrade and the init process leaves out the index.
# Unless we create it, gerrit refuses to start with errors like
# 1) No index versions ready; run Reindex
exec { 'gerrit-initial-index':
user => 'gerrit2',
command => "/usr/bin/java -jar ${gerrit_war} reindex -d ${gerrit_site} --threads ${reindex_threads}",
subscribe => [Exec['gerrit-initial-init']],
refreshonly => true,
logoutput => true,
}
# We can now online reindex, so no need to run this on upgrades by
# default.
if ($offline_reindex) {
exec { 'gerrit-reindex':
user => 'gerrit2',
command => "/usr/bin/java -jar ${gerrit_war} reindex -d ${gerrit_site} --threads ${reindex_threads}",
subscribe => [File['/home/gerrit2/review_site/bin/gerrit.war'],
Exec['gerrit-initial-init'],
Exec['gerrit-init']],
refreshonly => true,
logoutput => true,