This commit is contained in:
Joe Topjian 2012-09-10 06:04:34 +00:00
parent eb60ddbfeb
commit 58e387284e
4 changed files with 47 additions and 5 deletions

View File

@ -1,18 +1,36 @@
#
class cinder::db::mysql (
$password,
$dbname = 'cinder',
$user = 'cinder',
$dbname = 'cinder',
$user = 'cinder',
$host = '127.0.0.1',
$allowed_hosts = undef,
$charset = 'latin1',
$cluster_id = 'localzone'
) {
include cinder::params
Class['mysql::server'] -> Class['cinder::db::mysql']
Class['cinder::db::mysql'] -> Class['cinder::db::sync']
Database[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
mysql::db { $dbname:
host => '127.0.0.1',
user => $user,
password => $password,
user => $user,
password => $password,
host => $host,
charset => $charset,
# I may want to inject some sql
require => Class['mysql::config'],
}
if $allowed_hosts {
# TODO this class should be in the mysql namespace
cinder::db::mysql::host_access { $allowed_hosts:
user => $user,
password => $password,
database => $dbname,
}
}
}

View File

@ -0,0 +1,16 @@
#
# Used to grant access to the cinder mysql DB
#
define cinder::db::mysql::host_access ($user, $password, $database) {
database_user { "${user}@${name}":
password_hash => mysql_password($password),
provider => 'mysql',
require => Database[$database],
}
database_grant { "${user}@${name}/${database}":
# TODO figure out which privileges to grant.
privileges => "all",
provider => 'mysql',
require => Database_user["${user}@${name}"]
}
}

View File

@ -9,5 +9,6 @@ class cinder::db::sync {
user => 'cinder',
refreshonly => true,
require => [File[$::cinder::params::cinder_conf], Class['cinder']],
logoutput => 'on_failure',
}
}

View File

@ -29,6 +29,13 @@ class cinder (
file { $::cinder::params::cinder_conf: }
file { $::cinder::params::cinder_paste_api_ini: }
# Temporary fixes
file { ['/var/log/cinder', '/var/lib/cinder']:
ensure => directory,
owner => 'cinder',
group => 'adm',
}
if $cinder_settings {
multini($::cinder::params::cinder_conf, $cinder_settings)
}