Allow puppet to configure gerrit commitmessage parameters

Allow puppet to configure the Gerrit's commitmessage[1] options

[1] https://review.openstack.org/plugins/commit-message-length-validator/Documentation/config.html

Change-Id: Id7aff7d6d7250da804c690fbe6ff5b81f408d113
This commit is contained in:
Khai Do 2016-05-13 08:58:13 -07:00
parent 0b209db93b
commit c2824df95c
3 changed files with 25 additions and 0 deletions

View File

@ -127,6 +127,14 @@
# 'scheme' => ['ssh', 'anon_http', 'anon_git'],
# 'archive' => ['tar', 'tbz2', 'tgz', 'txz'],
# },
# commitmessage_params:
# A dict of commit message parameters, valid params are: maxLineLength,
# longLinesThreshold, rejectTooLong, and maxSubjectLength.
# Example:
# commitmessage_params => {
# maxSubjectLength => '60',
# maxLineLength => '72',
# },
# java_home:
# The path to java home directory
# TODO: make more gerrit options configurable here
@ -224,6 +232,7 @@ class gerrit(
$cache_diff_timeout = '',
$cache_diff_intraline_timeout = '',
$download = {},
$commitmessage_params = {},
$java_home = '/usr/lib/jvm/java-7-openjdk-amd64/jre',
) {
include ::httpd
@ -403,6 +412,7 @@ class gerrit(
# - $cache_diff_timeout
# - $cache_diff_intraline_timeout
# - $download
# - $commitmessage_params
file { '/home/gerrit2/review_site/etc/gerrit.config':
ensure => present,

View File

@ -33,6 +33,13 @@ class { '::gerrit':
ssh_replication_rsa_pubkey_contents => file('/tmp/gerrit-ssh-keys/ssh_replication_rsa_key.pub'),
secondary_index => true,
secondary_index_type => 'LUCENE',
commitmessage_params =>
{
maxSubjectLength => '60',
maxLineLength => '72',
longLinesThreshold => '20',
rejectTooLong => 'true',
},
}
class { '::gerrit::cron': }

View File

@ -190,6 +190,14 @@
<% end -%>
<% end -%>
<% end -%>
<% unless @commitmessage_params.nil? or @commitmessage_params.empty? -%>
[commitmessage]
<% @commitmessage_params.each do |key, value| -%>
<% if key == "maxLineLength" or key == "longLinesThreshold" or key == "rejectTooLong" or key == "maxSubjectLength" -%>
<%= key %> = <%= value %>
<% end -%>
<% end -%>
<% end -%>
[groups]
newGroupsVisibleToAll = <%= @new_groups_visible_to_all %>
[mimetype "image/*"]