Support setting accountPatchReviewDb.url in config

Add accountPatchReviewDb.url as a configurable option to the secure
config file (we put it in secure config as the url likely contains a
database password in it). This is a new database in Gerrit 2.13 which
will default to using an H2 db in review_site/db if a url is not
specified.

Note that this database must have a different name than the review
database (called 'reviewdb' by this module) and if they are the same
that database will be dropped and you will have a sad afternoon.

Change-Id: Ifc04395f076200a68e6398190a0712c80e5278c6
This commit is contained in:
Clark Boylan 2017-06-27 09:56:31 -07:00
parent 61f6803f1e
commit a52cab89f3
2 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,12 @@
# The password with which gerrit connects to mysql.
# mysql_host:
# The mysql host to which gerrit should connect.
# accountpatchreviewdb_url:
# The url to the account patch review database. This database must be
# separate from your normal reviewdb as setting them to be the same
# will cause the reviewdb to be dropped. Note this puppet module uses
# 'reviewdb' for the review database, therefore don't use this name here.
# If not set then gerrit will use a default H2 database in review_site/db.
# vhost_name:
# used in the Apache virtual host, eg., review.example.com
# redirect_to_canonicalweburl:
@ -175,6 +181,7 @@
#
class gerrit(
$mysql_password,
$accountpatchreviewdb_url = undef,
$mysql_host = 'localhost',
$war = '',
$email_private_key = '',
@ -471,7 +478,8 @@ class gerrit(
# Gerrit sets these permissions in 'init'; don't fight them. If
# these permissions aren't set correctly, gerrit init will write a
# new secure.config file and lose the mysql password.
# Template uses $mysql_password, $email_private_key and $token_private_key
# Template uses $mysql_password, $email_private_key, $token_private_key,
# and accountpatchreviewdb_url.
file { '/home/gerrit2/review_site/etc/secure.config':
ensure => present,
owner => 'gerrit2',

View File

@ -1,5 +1,9 @@
[database]
password = <%= @mysql_password %>
<% if @accountpatchreviewdb_url -%>
[accountPatchReviewDb]
url = <%= @accountpatchreviewdb_url %>
<% end -%>
[auth]
registerEmailPrivateKey = <%= @email_private_key %>
restTokenPrivateKey = <%= @token_private_key %>