Switch subunit2sql to use decomposed uri

This commit switches the subunit2sql_uri which get's passed into the
config file template to use decomposed values. The advantage of this
is that it enables using subsets of the information elsewhere.

Change-Id: I30b5117c12897fa3a1cb1e2579b4eec59ba57b2b
This commit is contained in:
Matthew Treinish 2014-12-03 15:44:42 -05:00
parent 68a06213c2
commit 5941f835ac
6 changed files with 31 additions and 12 deletions

View File

@ -325,7 +325,8 @@ node 'logstash.openstack.org' {
'elasticsearch06.openstack.org:9200',
'elasticsearch07.openstack.org:9200',
],
subunit2sql_db_uri => hiera('subunit2sql_db_uri', ''),
subunit2sql_db_host => hiera('subunit2sql_db_host', ''),
subunit2sql_db_pass => hiera('subunit2sql_db_password', ''),
}
}
@ -343,7 +344,8 @@ node /^logstash-worker\d+\.openstack\.org$/ {
node /^subunit-worker\d+\.openstack\.org$/ {
class { 'openstack_project::subunit_worker':
sysadmins => hiera('sysadmins', []),
subunit2sql_db_uri => hiera('subunit2sql_db_uri', ''),
subunit2sql_db_host => hiera('subunit2sql_db_host', ''),
subunit2sql_db_pass => hiera('subunit2sql_db_password', ''),
}
}

View File

@ -20,7 +20,8 @@ class openstack_project::logstash (
$discover_nodes = ['elasticsearch01.openstack.org:9200'],
$statsd_host = 'graphite.openstack.org',
$sysadmins = [],
$subunit2sql_db_uri= ''
$subunit2sql_db_host,
$subunit2sql_db_pass,
) {
$iptables_es_rule = regsubst ($elasticsearch_nodes, '^(.*)$', '-m state --state NEW -m tcp -p tcp --dport 9200:9400 -s \1 -j ACCEPT')
$iptables_gm_rule = regsubst ($gearman_workers, '^(.*)$', '-m state --state NEW -m tcp -p tcp --dport 4730 -s \1 -j ACCEPT')
@ -48,6 +49,7 @@ class openstack_project::logstash (
include 'subunit2sql'
class { 'subunit2sql::server':
subunit2sql_db_uri => $subunit2sql_db_uri,
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}
}

View File

@ -16,7 +16,8 @@
#
class openstack_project::subunit_worker (
$sysadmins = [],
$subunit2sql_db_uri
$subunit2sql_db_host,
$subunit2sql_db_pass,
) {
class { 'openstack_project::server':
iptables_public_tcp_ports => [22],
@ -26,18 +27,22 @@ class openstack_project::subunit_worker (
include subunit2sql
subunit2sql::worker { 'A':
config_file => 'puppet:///modules/openstack_project/logstash/jenkins-subunit-worker.yaml',
subunit2sql_db_uri => $subunit2sql_db_uri,
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}
subunit2sql::worker { 'B':
config_file => 'puppet:///modules/openstack_project/logstash/jenkins-subunit-worker.yaml',
subunit2sql_db_uri => $subunit2sql_db_uri,
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}
subunit2sql::worker { 'C':
config_file => 'puppet:///modules/openstack_project/logstash/jenkins-subunit-worker.yaml',
subunit2sql_db_uri => $subunit2sql_db_uri,
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}
subunit2sql::worker { 'D':
config_file => 'puppet:///modules/openstack_project/logstash/jenkins-subunit-worker.yaml',
subunit2sql_db_uri => $subunit2sql_db_uri,
db_host => $subunit2sql_db_host,
db_pass => $subunit2sql_db_pass,
}
}

View File

@ -16,7 +16,12 @@
# == Class: subunit2sql
#
class subunit2sql::server (
$subunit2sql_db_uri,
$db_dialect = 'mysql',
$db_user = 'subunit2sql',
$db_pass,
$db_host,
$db_port = '3306',
$db_name = 'subunit2sql',
) {
file { '/etc/subunit2sql.conf':

View File

@ -17,7 +17,12 @@
#
define subunit2sql::worker (
$config_file,
$subunit2sql_db_uri,
$db_dialect = 'mysql',
$db_user = 'subunit2sql',
$db_pass,
$db_host,
$db_port = '3306',
$db_name = 'subunit2sql'
) {
$suffix = "-${name}"

View File

@ -1,4 +1,4 @@
[DEFAULT]
[database]
connection = <%= subunit2sql_db_uri %>
connection = <%= @db_dialect %>://<%= @db_user %>:<%= @db_pass %>@<%= @db_host %>:<%= @db_port %>/<%= @db_name %>