Move sqlite and mysql config into a config namespace

Previously, the mysql config was coupled with
keystone::mysql. This was problemtatic b/c the
config is for a database client which may not
reside on the same server as the db itself.

This commit creates a new config namespace and
puts the db specific config there.

It also moves the sql template to mysql
This commit is contained in:
Dan Bode 2012-04-05 11:13:21 -07:00
parent 0ce236a11d
commit fa4c75dc64
6 changed files with 85 additions and 31 deletions

View File

@ -19,8 +19,7 @@ class { 'keystone::repo::trunk':
# keystone instance backed by sqlite
# with all of the default admin roles
node keystone {
class { 'concat::setup': }
class { 'keystone::sqlite': }
class { 'keystone::config::sqlite': }
class { 'keystone':
log_verbose => true,
log_debug => true,

59
manifests/config/mysql.pp Normal file
View File

@ -0,0 +1,59 @@
# Class used to configure keystone connection information
# for mysql databases.
#
# [*Parameters*]
#
# [user] User keystone should use to connect to database. Optional. Defaults to keystone_admin
#
# [password] Password that keystone should use to connect to database.
# Optional. Defaults to: 'keystone_default_password'
#
# [host] Host where keystone should connect to database.
# Optional. Defaults to 127.0.0.1.
#
# [dbname] Name of database that keystone should connect to. Optional. Defaults to keystone.
#
# [idle_timeout] TODO document
#
# [min_pool_size] TODO document
#
# [max_pool_size] TODO document
#
# [pool_timeout] TODO document
#
# == Dependencies
# == Examples
# == Authors
#
# Dan Bode dan@puppetlabs.com
#
# == Copyright
#
# Copyright 2012 Puppetlabs Inc, unless otherwise noted.
#
class keystone::config::mysql(
$user = 'keystone_admin',
$password = 'keystone_default_password',
$host = '127.0.0.1',
$dbname = 'keystone',
$idle_timeout = '300',
$min_pool_size = '5',
$max_pool_size = '10',
$pool_timeout = '200'
) {
keystone::config { 'mysql':
config => {
user => $user,
password => $password,
host => $host,
dbname => $dbname,
idle_timeout => $idle_timeout,
min_pool_size => $min_pool_size,
max_pool_size => $max_pool_size,
pool_timeout => $pool_timeout
},
order => '02',
}
}

View File

@ -0,0 +1,25 @@
#
# Manages configuration section for sqlite backend.
#
# == Dependencies
# == Examples
# == Authors
#
# Dan Bode dan@puppetlabs.com
#
# == Copyright
#
# Copyright 2012 Puppetlabs Inc, unless otherwise noted.
#
class keystone::config::sqlite(
$idle_timeout = 200
) {
keystone::config { 'sql':
content => inline_template('
[sql]
connection = sqlite:////var/lib/keystone/keystone.db
idle_timeout = <%= idle_timeout %>
'),
order => '02',
}
}

View File

@ -6,10 +6,6 @@ class keystone::mysql(
$dbname = 'keystone',
$user = 'keystone_admin',
$host = '127.0.0.1',
$idle_timeout = '300',
$min_pool_size = '5',
$max_pool_size = '10',
$pool_timeout = '200',
$allowed_hosts = undef
) {
@ -29,17 +25,4 @@ class keystone::mysql(
require => Class['mysql::server'],
}
keystone::config { 'sql':
config => {
user => $user,
password => $password,
host => $host,
dbname => $dbname,
idle_timeout => $idle_timeout,
min_pool_size => $min_pool_size,
max_pool_size => $max_pool_size,
pool_timeout => $pool_timeout
},
order => '02',
}
}

View File

@ -1,12 +0,0 @@
class keystone::sqlite(
$idle_timeout = 200
) {
keystone::config { 'sql':
content => inline_template('
[sql]
connection = sqlite:////var/lib/keystone/keystone.db
idle_timeout = <%= idle_timeout %>
'),
order => '02',
}
}