Merge pull request #249 from mgagne/add_db_mysql_charset_param
Allow to set charset in nova::db::mysql
This commit is contained in:
commit
7d73df2eec
|
@ -6,12 +6,11 @@ class nova::db::mysql(
|
|||
$dbname = 'nova',
|
||||
$user = 'nova',
|
||||
$host = '127.0.0.1',
|
||||
$charset = 'latin1',
|
||||
$allowed_hosts = undef,
|
||||
$cluster_id = 'localzone'
|
||||
) {
|
||||
|
||||
include 'nova::params'
|
||||
|
||||
require 'mysql::python'
|
||||
# Create the db instance before openstack-nova if its installed
|
||||
Mysql::Db[$dbname] -> Anchor<| title == "nova-start" |>
|
||||
|
@ -21,7 +20,7 @@ class nova::db::mysql(
|
|||
user => $user,
|
||||
password => $password,
|
||||
host => $host,
|
||||
charset => $nova::params::nova_db_charset,
|
||||
charset => $charset,
|
||||
# I may want to inject some sql
|
||||
require => Class['mysql::config'],
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ class nova::params {
|
|||
# redhat specific config defaults
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lib/nova/tmp'
|
||||
$nova_db_charset = 'latin1'
|
||||
}
|
||||
'Debian': {
|
||||
# package names
|
||||
|
@ -65,7 +64,6 @@ class nova::params {
|
|||
# debian specific nova config
|
||||
$root_helper = 'sudo nova-rootwrap'
|
||||
$lock_path = '/var/lock/nova'
|
||||
$nova_db_charset = 'latin1'
|
||||
case $::operatingsystem {
|
||||
'Debian': {
|
||||
$consoleauth_package_name = 'nova-console'
|
||||
|
|
|
@ -1,34 +1,61 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nova::db::mysql' do
|
||||
let :required_params do
|
||||
{ :password => "qwerty" }
|
||||
end
|
||||
|
||||
context 'on a Debian osfamily' do
|
||||
let :facts do
|
||||
{ :osfamily => "Debian" }
|
||||
end
|
||||
let :params do
|
||||
{ :password => "qwerty" }
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
required_params
|
||||
end
|
||||
|
||||
it { should contain_mysql__db('nova').with(
|
||||
:user => 'nova',
|
||||
:password => 'qwerty',
|
||||
:charset => 'latin1',
|
||||
:require => "Class[Mysql::Config]"
|
||||
)}
|
||||
end
|
||||
|
||||
context 'when overriding charset' do
|
||||
let :params do
|
||||
{ :charset => 'utf8' }.merge(required_params)
|
||||
end
|
||||
|
||||
it { should contain_mysql__db('nova').with_charset(params[:charset]) }
|
||||
end
|
||||
it { should contain_mysql__db('nova').with(
|
||||
:user => 'nova',
|
||||
:password => 'qwerty',
|
||||
:charset => 'latin1',
|
||||
:require => "Class[Mysql::Config]"
|
||||
)}
|
||||
end
|
||||
|
||||
context 'on a RedHat osfamily' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
let :params do
|
||||
{ :password => 'qwerty' }
|
||||
|
||||
context 'with only required parameters' do
|
||||
let :params do
|
||||
required_params
|
||||
end
|
||||
|
||||
it { should contain_mysql__db('nova').with(
|
||||
:user => 'nova',
|
||||
:password => 'qwerty',
|
||||
:charset => 'latin1',
|
||||
:require => "Class[Mysql::Config]"
|
||||
)}
|
||||
end
|
||||
|
||||
context 'when overriding charset' do
|
||||
let :params do
|
||||
{ :charset => 'utf8' }.merge(required_params)
|
||||
end
|
||||
|
||||
it { should contain_mysql__db('nova').with_charset(params[:charset]) }
|
||||
end
|
||||
it { should contain_mysql__db('nova').with(
|
||||
:user => 'nova',
|
||||
:password => 'qwerty',
|
||||
:charset => 'latin1',
|
||||
:require => "Class[Mysql::Config]"
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue