Move OpenStack branding and launchpad integration.

Launchpad integration and the OpenStack branding files are really
more about the OpenStack specific install of Gerrit than they are
about any installation of gerrit. Both of these are moved to the
openstack_project module.

Change-Id: I8b281aa5cb751a8023c2101c45146a3aca5f90f3
This commit is contained in:
Monty Taylor 2012-07-23 11:34:36 -05:00
parent 1b61f7673b
commit 5609c50cd5
13 changed files with 119 additions and 96 deletions

View File

@ -26,8 +26,6 @@
# Gerrit configuration options; see Gerrit docs.
# commentlinks:
# A list of regexes Gerrit should hyperlink.
# logo:
# The name of the image file for the site header.
# war:
# The URL of the Gerrit WAR that should be downloaded and installed.
# Note that only the final component is used for comparing to the most
@ -44,13 +42,15 @@
# to:
# http://tarballs.openstack.org/ci/gerrit-2.3.0.war
# Gerrit will be upgraded on the next puppet run.
# testmode:
# Set this to true to disable cron jobs and replication,
# which can interfere with testing.
# TODO: move apache configuration to another module
# TODO: move mysql configuration to another module
# TODO: make more gerrit options configurable here
# TODO: launchpadlib creds for user sync script
class gerrit($virtual_hostname='',
class gerrit($virtual_hostname=$fqdn,
$canonicalweburl="https://$fqdn/",
$canonicalweburl='',
$ssl_cert_file='',
$ssl_key_file='',
@ -68,20 +68,15 @@ class gerrit($virtual_hostname='',
$httpd_maxthreads='',
$httpd_maxwait='',
$commentlinks = [],
$logo,
$war,
$script_user,
$script_key_file,
$script_site,
$enable_melody = 'false',
$melody_session = 'false',
$mysql_password,
$email_private_key
) {
# Set this to true to disable cron jobs and replication, which can
# interfere with testing.
$testmode = false
$email_private_key,
$testmode=false
) {
user { "gerrit2":
ensure => present,
@ -100,27 +95,12 @@ class gerrit($virtual_hostname='',
$packages = ["gitweb",
"openjdk-6-jre-headless",
"mysql-server",
"python-mysqldb", # for launchpad sync script
"python-openid", # for launchpad sync script
"python-launchpadlib", # for launchpad sync script
"apache2"]
package { $packages:
ensure => present,
}
# Skip cron jobs if we're in test mode
if ($testmode == false) {
cron { "gerritsyncusers":
user => gerrit2,
minute => "*/15",
command => "sleep $((RANDOM\\%60+60)) && python /usr/local/gerrit/scripts/update_gerrit_users.py ${script_user} ${script_key_file} ${script_site}",
require => File['/usr/local/gerrit/scripts'],
}
} # testmode==false
file { "/var/log/gerrit":
ensure => "directory",
owner => 'gerrit2'
@ -148,40 +128,23 @@ class gerrit($virtual_hostname='',
require => File["/home/gerrit2/review_site"]
}
file { "/home/gerrit2/review_site/hooks":
ensure => "directory",
owner => "gerrit2",
require => File["/home/gerrit2/review_site"]
}
file { "/home/gerrit2/review_site/static":
ensure => "directory",
owner => "gerrit2",
require => File["/home/gerrit2/review_site"]
}
file { '/home/gerrit2/review_site/static/title.png':
ensure => 'present',
source => "puppet:///modules/gerrit/${logo}",
}
file { '/home/gerrit2/review_site/static/openstack-page-bkg.jpg':
ensure => 'present',
source => 'puppet:///modules/gerrit/openstack-page-bkg.jpg'
}
file { '/home/gerrit2/review_site/etc/GerritSite.css':
ensure => 'present',
source => 'puppet:///modules/gerrit/GerritSite.css'
}
file { '/home/gerrit2/review_site/etc/GerritSiteHeader.html':
ensure => 'present',
source => 'puppet:///modules/gerrit/GerritSiteHeader.html'
file { "/home/gerrit2/review_site/hooks":
ensure => "directory",
owner => "gerrit2",
require => File["/home/gerrit2/review_site"]
}
# Skip replication if we're in test mode
if ($testmode == false) {
# TODO: This file needs to be templated with a boolean around
# enabling replication to github. Also, the local repos need
# to be managed in here when we get project creation handled
file { '/home/gerrit2/review_site/etc/replication.config':
owner => 'root',
group => 'root',
@ -204,36 +167,6 @@ class gerrit($virtual_hostname='',
require => File["/home/gerrit2/review_site/etc"]
}
file { '/home/gerrit2/review_site/hooks/change-merged':
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/change-merged',
replace => 'true',
require => File["/home/gerrit2/review_site/hooks"]
}
file { '/home/gerrit2/review_site/hooks/patchset-created':
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/patchset-created',
replace => 'true',
require => File["/home/gerrit2/review_site/hooks"]
}
file { '/home/gerrit2/review_site/static/echosign-cla.html':
owner => 'root',
group => 'root',
mode => 444,
ensure => 'present',
source => 'puppet:///modules/gerrit/echosign-cla.html',
replace => 'true',
require => File["/home/gerrit2/review_site/static"]
}
# Secret files.
# Gerrit sets these permissions in 'init'; don't fight them. If

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,3 +1,8 @@
# A wrapper class around the main gerrit class that sets gerrit
# up for launchpad single sign on, bug/blueprint links and user
# import and sync
# TODO: launchpadlib creds for user sync script
class openstack_project::gerrit (
$ssl_cert_file='',
$ssl_key_file='',
@ -13,25 +18,32 @@ class openstack_project::gerrit (
$httpd_minthreads='',
$httpd_maxthreads='',
$httpd_maxwait='',
$github_projects = [],
$war,
$script_user,
$script_key_file,
$github_projects = [],
$github_user,
$github_token,
$mysql_password,
$email_private_key
$email_private_key,
$testmode=false,
) {
class { 'openstack_project::server':
iptables_public_tcp_ports => [80, 443, 29418]
}
$packages = [
"python-mysqldb", # for launchpad sync script
"python-openid", # for launchpad sync script
"python-launchpadlib", # for launchpad sync script
]
package { $packages:
ensure => present,
}
class { 'gerrit':
# opinions
virtual_hostname => $fqdn,
canonicalweburl => "https://$fqdn/",
logo => 'openstack.png',
script_site => 'openstack',
enable_melody => 'true',
melody_session => 'true',
# passthrough
@ -39,6 +51,7 @@ class openstack_project::gerrit (
ssl_key_file => $ssl_key_file,
ssl_chain_file => $ssl_chain_file,
email => $email,
openidssourl => "https://login.launchpad.net/+openid",
database_poollimit => $database_poollimit,
container_heaplimit => $container_heaplimit,
core_packedgitopenfiles => $core_packedgitopenfiles,
@ -64,16 +77,93 @@ class openstack_project::gerrit (
war => $war,
script_user => $script_user,
script_key_file => $script_key_file,
script_site => 'openstack',
mysql_password => $mysql_password,
email_private_key => $email_private_key
email_private_key => $email_private_key,
testmode => $testmode,
}
class { 'gerrit::cron':
script_user => $script_user,
script_key_file => $script_key_file,
if ($testmode == false) {
class { 'gerrit::cron':
script_user => $script_user,
script_key_file => $script_key_file,
}
class { 'github':
github_projects => $github_projects,
github_user => $github_username,
github_token => $github_oauth_token,
}
}
class { 'github':
github_projects => $github_projects,
github_user => $github_username,
github_token => $github_oauth_token,
file { '/home/gerrit2/review_site/static/echosign-cla.html':
owner => 'root',
group => 'root',
mode => 444,
ensure => 'present',
source => 'puppet:///modules/openstack_project/gerrit/echosign-cla.html',
replace => 'true',
require => Class['gerrit::launchpad'],
}
file { '/home/gerrit2/review_site/static/title.png':
ensure => 'present',
source => "puppet:///modules/openstack_project/openstack.png",
require => Class['gerrit::launchpad'],
}
file { '/home/gerrit2/review_site/static/openstack-page-bkg.jpg':
ensure => 'present',
source => 'puppet:///modules/openstack_project/openstack-page-bkg.jpg',
require => Class['gerrit::launchpad'],
}
file { '/home/gerrit2/review_site/etc/GerritSite.css':
ensure => 'present',
source => 'puppet:///modules/openstack_project/gerrit/GerritSite.css',
require => Class['gerrit::launchpad'],
}
file { '/home/gerrit2/review_site/etc/GerritSiteHeader.html':
ensure => 'present',
source => 'puppet:///modules/openstack_project/GerritSiteHeader.html',
require => Class['gerrit::launchpad'],
}
cron { "gerritsyncusers":
user => gerrit2,
minute => "*/15",
command => "sleep $((RANDOM\\%60+60)) && python /usr/local/gerrit/scripts/update_gerrit_users.py ${script_user} ${script_key_file} ${script_site}",
require => File['/usr/local/gerrit/scripts'],
}
file { '/usr/local/gerrit/scripts':
owner => 'root',
group => 'root',
mode => 755,
ensure => 'directory',
recurse => true,
require => Class['gerrit'],
source => [
"puppet:///modules/openstack_project/gerrit/scripts",
],
}
file { '/home/gerrit2/review_site/hooks/change-merged':
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/change-merged',
replace => 'true',
require => Class['gerrit']
}
file { '/home/gerrit2/review_site/hooks/patchset-created':
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/patchset-created',
replace => 'true',
require => Class['gerrit']
}
}