Merge "Makes kombu_ssl_* parameters optional when rabbit_use_ssl => true" into stable/icehouse
This commit is contained in:
commit
d6f0e4c5e6
|
@ -141,16 +141,17 @@ class heat(
|
|||
|
||||
include heat::params
|
||||
|
||||
if $rabbit_use_ssl {
|
||||
if !$kombu_ssl_ca_certs {
|
||||
fail('The kombu_ssl_ca_certs parameter is required when rabbit_use_ssl is set to true')
|
||||
}
|
||||
if !$kombu_ssl_certfile {
|
||||
fail('The kombu_ssl_certfile parameter is required when rabbit_use_ssl is set to true')
|
||||
}
|
||||
if !$kombu_ssl_keyfile {
|
||||
fail('The kombu_ssl_keyfile parameter is required when rabbit_use_ssl is set to true')
|
||||
}
|
||||
if $kombu_ssl_ca_certs and !$rabbit_use_ssl {
|
||||
fail('The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true')
|
||||
}
|
||||
if $kombu_ssl_certfile and !$rabbit_use_ssl {
|
||||
fail('The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true')
|
||||
}
|
||||
if $kombu_ssl_keyfile and !$rabbit_use_ssl {
|
||||
fail('The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true')
|
||||
}
|
||||
if ($kombu_ssl_certfile and !$kombu_ssl_keyfile) or ($kombu_ssl_keyfile and !$kombu_ssl_certfile) {
|
||||
fail('The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together')
|
||||
}
|
||||
|
||||
File {
|
||||
|
@ -221,12 +222,31 @@ class heat(
|
|||
}
|
||||
|
||||
if $rabbit_use_ssl {
|
||||
heat_config {
|
||||
'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs;
|
||||
'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile;
|
||||
'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
|
||||
'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version;
|
||||
|
||||
if $kombu_ssl_ca_certs {
|
||||
heat_config { 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; }
|
||||
} else {
|
||||
heat_config { 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; }
|
||||
}
|
||||
|
||||
if $kombu_ssl_certfile or $kombu_ssl_keyfile {
|
||||
heat_config {
|
||||
'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile;
|
||||
'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
|
||||
}
|
||||
} else {
|
||||
heat_config {
|
||||
'DEFAULT/kombu_ssl_certfile': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_keyfile': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $kombu_ssl_version {
|
||||
heat_config { 'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version; }
|
||||
} else {
|
||||
heat_config { 'DEFAULT/kombu_ssl_version': ensure => absent; }
|
||||
}
|
||||
|
||||
} else {
|
||||
heat_config {
|
||||
'DEFAULT/kombu_ssl_version': ensure => absent;
|
||||
|
|
|
@ -64,7 +64,8 @@ describe 'heat' do
|
|||
it_configures 'with syslog disabled'
|
||||
it_configures 'with syslog enabled'
|
||||
it_configures 'with syslog enabled and custom settings'
|
||||
it_configures 'with SSL enabled'
|
||||
it_configures 'with SSL enabled with kombu'
|
||||
it_configures 'with SSL enabled without kombu'
|
||||
it_configures 'with SSL disabled'
|
||||
it_configures 'with SSL wrongly configured'
|
||||
end
|
||||
|
@ -242,7 +243,7 @@ describe 'heat' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'with SSL enabled' do
|
||||
shared_examples_for 'with SSL enabled with kombu' do
|
||||
before do
|
||||
params.merge!(
|
||||
:rabbit_use_ssl => true,
|
||||
|
@ -262,13 +263,26 @@ describe 'heat' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'with SSL enabled without kombu' do
|
||||
before do
|
||||
params.merge!(
|
||||
:rabbit_use_ssl => true
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_heat_config('DEFAULT/rabbit_use_ssl').with_value('true')
|
||||
should contain_heat_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent')
|
||||
should contain_heat_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent')
|
||||
should contain_heat_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent')
|
||||
should contain_heat_config('DEFAULT/kombu_ssl_version').with_value('SSLv3')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'with SSL disabled' do
|
||||
before do
|
||||
params.merge!(
|
||||
:rabbit_use_ssl => false,
|
||||
:kombu_ssl_ca_certs => 'undef',
|
||||
:kombu_ssl_certfile => 'undef',
|
||||
:kombu_ssl_keyfile => 'undef',
|
||||
:kombu_ssl_version => 'SSLv3'
|
||||
)
|
||||
end
|
||||
|
@ -285,28 +299,25 @@ describe 'heat' do
|
|||
shared_examples_for 'with SSL wrongly configured' do
|
||||
before do
|
||||
params.merge!(
|
||||
:rabbit_use_ssl => true,
|
||||
:kombu_ssl_ca_certs => 'undef',
|
||||
:kombu_ssl_certfile => 'undef',
|
||||
:kombu_ssl_keyfile => 'undef'
|
||||
:rabbit_use_ssl => false
|
||||
)
|
||||
end
|
||||
|
||||
context 'without required parameters' do
|
||||
|
||||
context 'without kombu_ssl_ca_certs parameter' do
|
||||
before { params.delete(:kombu_ssl_ca_certs) }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_ca_certs parameter is required when rabbit_use_ssl is set to true/
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_ca_certs parameter' do
|
||||
before { params.merge!(:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs') }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
|
||||
context 'without kombu_ssl_certfile parameter' do
|
||||
before { params.delete(:kombu_ssl_certfile) }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_certfile parameter is required when rabbit_use_ssl is set to true/
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_certfile parameter' do
|
||||
before { params.merge!(:kombu_ssl_certfile => '/path/to/ssl/cert/file') }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
|
||||
context 'without kombu_ssl_keyfile parameter' do
|
||||
before { params.delete(:kombu_ssl_keyfile) }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_keyfile parameter is required when rabbit_use_ssl is set to true/
|
||||
context 'with rabbit_use_ssl => false and kombu_ssl_keyfile parameter' do
|
||||
before { params.merge!(:kombu_ssl_keyfile => '/path/to/ssl/keyfile') }
|
||||
it_raises 'a Puppet::Error', /The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true/
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue