Split gerritbot into its own module.

Change-Id: Ia9034d87321624006ccf447b058ee828a97fcc7a
This commit is contained in:
Monty Taylor 2012-07-23 09:22:57 -05:00
parent 9b54f3d886
commit e3e9aaba10
8 changed files with 66 additions and 68 deletions

View File

@ -46,7 +46,6 @@
# Gerrit will be upgraded on the next puppet run.
# TODO: move closing github pull requests to another module
# TODO: move gerritbot configuration to another module
# TODO: move apache configuration to another module
# TODO: move mysql configuration to another module
# TODO: make more gerrit options configurable here
@ -90,10 +89,6 @@ class gerrit($virtual_hostname='',
$script_site,
$enable_melody = 'false',
$melody_session = 'false',
$gerritbot_nick,
$gerritbot_password,
$gerritbot_server,
$gerritbot_user,
$github_user,
$github_token,
$mysql_password,
@ -191,43 +186,6 @@ class gerrit($virtual_hostname='',
require => File['/usr/local/gerrit/scripts'],
}
file { "/usr/local/gerrit/gerritbot":
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot',
}
file { "/etc/init.d/gerritbot":
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot.init',
require => File['/usr/local/gerrit/gerritbot'],
}
file { "/home/gerrit2/gerritbot_channel_config.yaml":
owner => 'root',
group => 'gerrit2',
mode => 440,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot_channel_config.yaml',
replace => true,
require => User['gerrit2']
}
service { 'gerritbot':
name => 'gerritbot',
ensure => running,
enable => true,
hasrestart => true,
require => File['/etc/init.d/gerritbot'],
subscribe => [File["/usr/local/gerrit/gerritbot"],
File["/home/gerrit2/gerritbot_channel_config.yaml"]],
}
} # testmode==false
file { "/var/log/gerrit":
@ -376,16 +334,6 @@ class gerrit($virtual_hostname='',
require => User['gerrit2']
}
file { '/home/gerrit2/gerritbot.config':
owner => 'root',
group => 'gerrit2',
mode => 440,
ensure => 'present',
content => template('gerrit/gerritbot.config.erb'),
replace => 'true',
require => User['gerrit2']
}
# 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.

View File

@ -0,0 +1,56 @@
class gerritbot(
$nick,
$password,
$server,
$user
) {
file { "/usr/local/gerrit/gerritbot":
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot',
require => File['/usr/local/gerrit'],
}
file { "/etc/init.d/gerritbot":
owner => 'root',
group => 'root',
mode => 555,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot.init',
require => File['/usr/local/gerrit/gerritbot'],
}
file { "/home/gerrit2/gerritbot_channel_config.yaml":
owner => 'root',
group => 'gerrit2',
mode => 440,
ensure => 'present',
source => 'puppet:///modules/gerrit/gerritbot_channel_config.yaml',
replace => true,
require => User['gerrit2'],
}
service { 'gerritbot':
name => 'gerritbot',
ensure => running,
enable => true,
hasrestart => true,
require => File['/etc/init.d/gerritbot'],
subscribe => [File["/usr/local/gerrit/gerritbot"],
File["/home/gerrit2/gerritbot_channel_config.yaml"]],
}
file { '/home/gerrit2/gerritbot.config':
owner => 'root',
group => 'gerrit2',
mode => 440,
ensure => 'present',
content => template('gerrit/gerritbot.config.erb'),
replace => 'true',
require => User['gerrit2']
}
}

View File

@ -1,13 +1,13 @@
[ircbot]
nick=<%= gerritbot_nick %>
pass=<%= gerritbot_password %>
server=<%= gerritbot_server %>
nick=<%= nick %>
pass=<%= password %>
server=<%= server %>
port=6667
channel_config=/home/gerrit2/gerritbot_channel_config.yaml
lockfile=/var/run/gerritbot/gerritbot.pid
[gerrit]
user=<%= gerritbot_user %>
user=<%= user %>
key=/home/gerrit2/.ssh/gerritbot_rsa
host=<%= virtual_hostname %>
port=29418

View File

@ -18,10 +18,6 @@ class openstack_project::gerrit (
$war,
$script_user,
$script_key_file,
$gerritbot_nick='',
$gerritbot_password='',
$gerritbot_server='',
$gerritbot_user='',
$github_user,
$github_token,
$mysql_password,
@ -59,10 +55,6 @@ class openstack_project::gerrit (
war => $war,
script_user => $script_user,
script_key_file => $script_key_file,
gerritbot_nick => $gerritbot_nick,
gerritbot_password => $gerritbot_password,
gerritbot_server => $gerritbot_server,
gerritbot_user => $gerritbot_user,
github_user => $github_user,
github_token => $github_token,
mysql_password => $mysql_password,

View File

@ -45,13 +45,15 @@ class openstack_project::review {
war => 'http://tarballs.openstack.org/ci/gerrit-2.4.1-10-g63110fd.war',
script_user => 'launchpadsync',
script_key_file => '/home/gerrit2/.ssh/launchpadsync_rsa',
gerritbot_nick => 'openstackgerrit',
gerritbot_password => hiera('gerrit_gerritbot_password'),
gerritbot_server => 'irc.freenode.net',
gerritbot_user => 'gerritbot',
github_user => 'openstack-gerrit',
github_token => hiera('gerrit_github_token'),
mysql_password => hiera('gerrit_mysql_password'),
email_private_key => hiera('gerrit_email_private_key'),
}
class { 'gerritbot':
gerritbot_nick => 'openstackgerrit',
gerritbot_password => hiera('gerrit_gerritbot_password'),
gerritbot_server => 'irc.freenode.net',
gerritbot_user => 'gerritbot'
}
}