Cleanup gerrit manifest lint errors.

Change-Id: I5a52c0fd0f5a35c32aa71c0f93500aa59e495066
Reviewed-on: https://review.openstack.org/14910
Reviewed-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Matthew Wagoner 2012-10-26 15:13:47 -04:00 committed by Jenkins
parent 2332c2ecfc
commit dbf0221db6
3 changed files with 94 additions and 79 deletions

View File

@ -1,31 +1,35 @@
# == Class: gerrit::cron
#
class gerrit::cron( class gerrit::cron(
$script_user = 'update', $script_user = 'update',
$script_key_file = '/home/gerrit2/.ssh/id_rsa' $script_key_file = '/home/gerrit2/.ssh/id_rsa'
) { ) {
cron { "expireoldreviews": cron { 'expireoldreviews':
user => gerrit2, user => 'gerrit2',
hour => 6, hour => '6',
minute => 3, minute => '3',
command => "python /usr/local/gerrit/scripts/expire_old_reviews.py ${script_user} ${script_key_file}", command => "python /usr/local/gerrit/scripts/expire_old_reviews.py \
${script_user} ${script_key_file}",
require => File['/usr/local/gerrit/scripts'], require => File['/usr/local/gerrit/scripts'],
} }
cron { "gerrit_repack": cron { 'gerrit_repack':
user => gerrit2, user => 'gerrit2',
weekday => 0, weekday => '0',
hour => 4, hour => '4',
minute => 7, minute => '7',
command => 'find /home/gerrit2/review_site/git/ -type d -name "*.git" -print -exec git --git-dir="{}" repack -afd \;', command => 'find /home/gerrit2/review_site/git/ -type d -name "*.git" \
environment => "PATH=/usr/bin:/bin:/usr/sbin:/sbin", -print -exec git --git-dir="{}" repack -afd \;',
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
} }
cron { "removedbdumps": cron { 'removedbdumps':
user => gerrit2, user => 'gerrit2',
hour => 5, hour => '5',
minute => 1, minute => '1',
command => 'find /home/gerrit2/dbupdates/ -name "*.sql.gz" -mtime +30 -exec rm -f {} \;', command => 'find /home/gerrit2/dbupdates/ -name "*.sql.gz" -mtime +30 \
environment => "PATH=/usr/bin:/bin:/usr/sbin:/sbin", -exec rm -f {} \;',
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
} }
} }

View File

@ -3,7 +3,8 @@
# vhost_name: # vhost_name:
# used in the Apache virtual host, eg., review.example.com # used in the Apache virtual host, eg., review.example.com
# canonicalweburl: # canonicalweburl:
# Used in the Gerrit config to generate links, eg., https://review.example.com/ # Used in the Gerrit config to generate links,
# eg., https://review.example.com/
# ssl_cert_file: # ssl_cert_file:
# ssl_key_file: # ssl_key_file:
# Used in the Apache virtual host to specify the SSL cert and key files. # Used in the Apache virtual host to specify the SSL cert and key files.
@ -65,9 +66,14 @@
# which can interfere with testing. # which can interfere with testing.
# TODO: make more gerrit options configurable here # TODO: make more gerrit options configurable here
class gerrit($vhost_name=$fqdn, class gerrit(
$canonicalweburl="https://${fqdn}/", $war,
$serveradmin="webmaster@${fqdn}", $mysql_password,
$mysql_root_password,
$email_private_key,
$vhost_name = $::fqdn,
$canonicalweburl = "https://${::fqdn}/",
$serveradmin = "webmaster@${::fqdn}",
$ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem', $ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem',
$ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key', $ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key',
$ssl_chain_file = '', $ssl_chain_file = '',
@ -91,17 +97,13 @@ class gerrit($vhost_name=$fqdn,
$httpd_maxthreads = '', $httpd_maxthreads = '',
$httpd_maxwait = '', $httpd_maxwait = '',
$commentlinks = [], $commentlinks = [],
$war,
$contactstore = false, $contactstore = false,
$contactstore_appsec = '', $contactstore_appsec = '',
$contactstore_pubkey = '', $contactstore_pubkey = '',
$contactstore_url = '', $contactstore_url = '',
$projects_file = 'UNDEF', $projects_file = 'UNDEF',
$enable_melody = 'false', $enable_melody = false,
$melody_session = 'false', $melody_session = false,
$mysql_password,
$mysql_root_password,
$email_private_key,
$replicate_github = false, $replicate_github = false,
$replicate_local = true, $replicate_local = true,
$local_git_dir = '/var/lib/git', $local_git_dir = '/var/lib/git',
@ -221,7 +223,8 @@ class gerrit($vhost_name=$fqdn,
exec { 'make_local_repos': exec { 'make_local_repos':
user => 'gerrit2', user => 'gerrit2',
command => "/usr/local/gerrit/scripts/make_local_repos.py ${local_git_dir}", command => "/usr/local/gerrit/scripts/make_local_repos.py \
${local_git_dir}",
subscribe => File['/home/gerrit2/projects.yaml'], subscribe => File['/home/gerrit2/projects.yaml'],
refreshonly => true, refreshonly => true,
require => File['/home/gerrit2/projects.yaml'], require => File['/home/gerrit2/projects.yaml'],
@ -373,8 +376,10 @@ class gerrit($vhost_name=$fqdn,
# Install Gerrit itself. # Install Gerrit itself.
# The Gerrit WAR is specified as a url like 'http://tarballs.openstack.org/ci/gerrit-2.2.2-363-gd0a67ce.war' # The Gerrit WAR is specified as a url like
# Set $basewar so that we can work with filenames like gerrit-2.2.2-363-gd0a67ce.war'. # 'http://tarballs.openstack.org/ci/gerrit-2.2.2-363-gd0a67ce.war'
# Set $basewar so that we can work with filenames like
# gerrit-2.2.2-363-gd0a67ce.war'.
if $war =~ /.*\/(.*)/ { if $war =~ /.*\/(.*)/ {
$basewar = $1 $basewar = $1
@ -402,8 +407,8 @@ class gerrit($vhost_name=$fqdn,
source => "file:///home/gerrit2/gerrit-wars/${basewar}", source => "file:///home/gerrit2/gerrit-wars/${basewar}",
require => Exec["download:${war}"], require => Exec["download:${war}"],
replace => true, replace => true,
# user, group, and mode have to be set this way to avoid retriggering gerrit-init on every run # user, group, and mode have to be set this way to avoid retriggering
# because gerrit init sets them this way # gerrit-init on every run because gerrit init sets them this way
owner => 'gerrit2', owner => 'gerrit2',
group => 'gerrit2', group => 'gerrit2',
mode => '0644', mode => '0644',
@ -413,7 +418,8 @@ class gerrit($vhost_name=$fqdn,
# If gerrit.war was just installed, run the Gerrit "init" command. # If gerrit.war was just installed, run the Gerrit "init" command.
exec { 'gerrit-initial-init': exec { 'gerrit-initial-init':
user => 'gerrit2', user => 'gerrit2',
command => '/usr/bin/java -jar /home/gerrit2/review_site/bin/gerrit.war init -d /home/gerrit2/review_site --batch --no-auto-start', command => '/usr/bin/java -jar /home/gerrit2/review_site/bin/gerrit.war \
init -d /home/gerrit2/review_site --batch --no-auto-start',
subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'], subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'],
require => [Package['openjdk-6-jre-headless'], require => [Package['openjdk-6-jre-headless'],
User['gerrit2'], User['gerrit2'],
@ -430,7 +436,9 @@ class gerrit($vhost_name=$fqdn,
# Running the init script as the gerrit2 user _does_ work. # Running the init script as the gerrit2 user _does_ work.
exec { 'gerrit-init': exec { 'gerrit-init':
user => 'gerrit2', user => 'gerrit2',
command => '/etc/init.d/gerrit stop; /usr/bin/java -jar /home/gerrit2/review_site/bin/gerrit.war init -d /home/gerrit2/review_site --batch --no-auto-start', command => '/etc/init.d/gerrit stop; /usr/bin/java -jar \
/home/gerrit2/review_site/bin/gerrit.war init \
-d /home/gerrit2/review_site --batch --no-auto-start',
subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'], subscribe => File['/home/gerrit2/review_site/bin/gerrit.war'],
refreshonly => true, refreshonly => true,
require => [Package['openjdk-6-jre-headless'], require => [Package['openjdk-6-jre-headless'],

View File

@ -1,13 +1,16 @@
# == Class: gerrit::remotes
#
class gerrit::remotes($ensure=present) { class gerrit::remotes($ensure=present) {
cron { "gerritfetchremotes": cron { 'gerritfetchremotes':
user => gerrit2,
ensure => $ensure, ensure => $ensure,
minute => "*/30", user => 'gerrit2',
command => 'sleep $((RANDOM\%60+90)) && python /usr/local/gerrit/scripts/fetch_remotes.py', minute => '*/30',
command => 'sleep $((RANDOM\%60+90)) && python \
/usr/local/gerrit/scripts/fetch_remotes.py',
require => File['/usr/local/gerrit/scripts'], require => File['/usr/local/gerrit/scripts'],
} }
file { '/home/gerrit2/remotes.config': file { '/home/gerrit2/remotes.config':
ensure => absent ensure => absent,
} }
} }