Use common defined resource type to manage ssl options

... and also remove the incomplete validation to catch ssl parameters
set without core boolean.

Change-Id: I8381cdf77924912bd48125ead5516f18c3ceb8cc
This commit is contained in:
Takashi Kajinami 2024-10-07 10:16:11 +09:00
parent df28e3d907
commit a2d0027208
2 changed files with 20 additions and 30 deletions

View File

@ -353,12 +353,6 @@ class neutron (
}
}
if ! is_service_default($use_ssl) and !($use_ssl) {
if ! is_service_default($ca_file) and ($ca_file) {
fail('The ca_file parameter requires that use_ssl to be set to true')
}
}
package { 'neutron':
ensure => $package_ensure,
name => $::neutron::params::package_name,
@ -439,9 +433,11 @@ class neutron (
# SSL Options
neutron_config {
'DEFAULT/use_ssl': value => $use_ssl;
'ssl/cert_file': value => $cert_file;
'ssl/key_file': value => $key_file;
'ssl/ca_file': value => $ca_file;
}
oslo::service::ssl { 'neutron_config':
cert_file => $cert_file,
key_file => $key_file,
ca_file => $ca_file,
}
}

View File

@ -24,7 +24,6 @@ describe 'neutron' do
it_behaves_like 'with SSL socket options set with wrong parameters'
it_behaves_like 'with SSL socket options left by default'
it_behaves_like 'with SSL socket options set and no ca_file'
it_behaves_like 'with SSL socket options disabled but ca_file'
it_behaves_like 'without service_plugins'
it_behaves_like 'with service_plugins'
it_behaves_like 'with host defined'
@ -173,9 +172,11 @@ describe 'neutron' do
end
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { should contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { should contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { should contain_neutron_config('ssl/ca_file').with_value('/path/to/ca') }
it { should contain_oslo__service__ssl('neutron_config').with(
:cert_file => '/path/to/cert',
:key_file => '/path/to/key',
:ca_file => '/path/to/ca'
) }
end
shared_examples 'with SSL socket options set with wrong parameters' do
@ -193,9 +194,11 @@ describe 'neutron' do
shared_examples 'with SSL socket options left by default' do
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/cert_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/key_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/ca_file').with_value('<SERVICE DEFAULT>') }
it { should contain_oslo__service__ssl('neutron_config').with(
:cert_file => '<SERVICE DEFAULT>',
:key_file => '<SERVICE DEFAULT>',
:ca_file => '<SERVICE DEFAULT>'
) }
end
shared_examples 'with SSL socket options set and no ca_file' do
@ -208,20 +211,11 @@ describe 'neutron' do
end
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { should contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { should contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { should contain_neutron_config('ssl/ca_file').with_value('<SERVICE DEFAULT>') }
end
shared_examples 'with SSL socket options disabled but ca_file' do
before do
params.merge!(
:use_ssl => false,
:ca_file => '/path/to/ca'
)
end
it { should raise_error(Puppet::Error, /The ca_file parameter requires that use_ssl to be set to true/) }
it { should contain_oslo__service__ssl('neutron_config').with(
:cert_file => '/path/to/cert',
:key_file => '/path/to/key',
:ca_file => '<SERVICE DEFAULT>'
) }
end
shared_examples 'with non-default kombu options' do