
In the origin glance::db::mysql, if the value of $allowed_hosts contains or equals to $host, then puppet will complain duplicate declaration error. This patch is aim to update the allowed_hosts conditonal statement in glance::db::mysql. There are two cases to pass $allowed_hosts to $real_allowed_hosts: - If $allowed_hosts is array,then remove $host from $allowed_hosts; - elsif $allowed_hosts is string and not equivalent to $host; At last, if $real_allowed_hosts is not undef, then run glance::db::mysql::host_access Fix bug 1206444 Change-Id: Ic70aaaec493195c7277782abb87469f9809e5baa
102 lines
2.2 KiB
Ruby
102 lines
2.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'glance::db::mysql' do
|
|
let :facts do
|
|
{
|
|
:osfamily => 'Debian'
|
|
}
|
|
end
|
|
|
|
let :pre_condition do
|
|
'include mysql::server'
|
|
end
|
|
|
|
describe "with default params" do
|
|
let :params do
|
|
{
|
|
:password => 'glancepass1'
|
|
}
|
|
end
|
|
|
|
it { should include_class('mysql::python') }
|
|
|
|
it { should contain_mysql__db('glance').with(
|
|
:password => 'glancepass1',
|
|
:require => 'Class[Mysql::Config]',
|
|
:charset => 'latin1'
|
|
)}
|
|
|
|
end
|
|
|
|
describe "overriding default params" do
|
|
let :params do
|
|
{
|
|
:password => 'glancepass2',
|
|
:dbname => 'glancedb2',
|
|
:charset => 'utf8',
|
|
}
|
|
end
|
|
|
|
it { should contain_mysql__db('glancedb2').with(
|
|
:password => 'glancepass2',
|
|
:charset => 'utf8'
|
|
)}
|
|
|
|
end
|
|
|
|
describe "overriding allowed_hosts param to array" do
|
|
let :params do
|
|
{
|
|
:password => 'glancepass2',
|
|
:dbname => 'glancedb2',
|
|
:allowed_hosts => ['127.0.0.1','%']
|
|
}
|
|
end
|
|
|
|
it {should_not contain_glance__db__mysql__host_access("127.0.0.1").with(
|
|
:user => 'glance',
|
|
:password => 'glancepass2',
|
|
:database => 'glancedb2'
|
|
)}
|
|
it {should contain_glance__db__mysql__host_access("%").with(
|
|
:user => 'glance',
|
|
:password => 'glancepass2',
|
|
:database => 'glancedb2'
|
|
)}
|
|
|
|
end
|
|
|
|
describe "overriding allowed_hosts param to string" do
|
|
let :params do
|
|
{
|
|
:password => 'glancepass2',
|
|
:dbname => 'glancedb2',
|
|
:allowed_hosts => '192.168.1.1'
|
|
}
|
|
end
|
|
|
|
it {should contain_glance__db__mysql__host_access("192.168.1.1").with(
|
|
:user => 'glance',
|
|
:password => 'glancepass2',
|
|
:database => 'glancedb2'
|
|
)}
|
|
end
|
|
|
|
describe "overriding allowed_hosts param equals to host param " do
|
|
let :params do
|
|
{
|
|
:password => 'glancepass2',
|
|
:dbname => 'glancedb2',
|
|
:allowed_hosts => '127.0.0.1'
|
|
}
|
|
end
|
|
|
|
it {should_not contain_glance__db__mysql__host_access("127.0.0.1").with(
|
|
:user => 'glance',
|
|
:password => 'glancepass2',
|
|
:database => 'glancedb2'
|
|
)}
|
|
end
|
|
|
|
end
|