From a52cab89f311c800c4cd45b274abe76b7db24b82 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 27 Jun 2017 09:56:31 -0700 Subject: [PATCH] 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 --- manifests/init.pp | 10 +++++++++- templates/secure.config.erb | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 08acd4b..9bdcf7f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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', diff --git a/templates/secure.config.erb b/templates/secure.config.erb index 94b2760..d9cce52 100644 --- a/templates/secure.config.erb +++ b/templates/secure.config.erb @@ -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 %>