Support more [cinder_client] parameters

Change-Id: Ib6ea67aee528cb5a592265ee823f884e4816d3ff
This commit is contained in:
Takashi Kajinami 2021-11-15 15:31:35 +09:00
parent 1faacc8c68
commit 565ce41450
3 changed files with 74 additions and 2 deletions

View File

@ -9,14 +9,51 @@
# with the OpenStack service.
# Defaults to RegionOne
#
# [*endpoint_type*]
# (optional) Type of endpoint in Identity service catalog to use for
# communication with the OpenStack service.
# Defaults to publicURL
#
# [*api_version*]
# (optional) Version of Cinder API to use in cinderclient.
# Defaoults to $::os_service_default
#
# [*ca_file*]
# (optional) CA cert file to use in SSL connections.
# Defaults to $::os_service_default
#
# [*cert_file*]
# (optional) PEM-formatted certificate chain file.
# Defaults to $::os_service_default
#
# [*key_file*]
# (optional) PEM-formatted file that contains the private key.
# Defaults to $::os_service_default
#
# [*insecure*]
# (optional) If set, then the server's certificate will not be verified.
# Defaults to false
#
class magnum::clients::cinder(
$region_name = $magnum::clients::region_name,
$endpoint_type = $magnum::clients::endpoint_type,
$api_version = $::os_service_default,
$ca_file = $magnum::clients::ca_file,
$cert_file = $magnum::clients::cert_file,
$key_file = $magnum::clients::key_file,
$insecure = $magnum::clients::insecure
){
include magnum::deps
include magnum::params
magnum_config {
'cinder_client/region_name': value => $region_name;
'cinder_client/region_name': value => $region_name;
'cinder_client/endpoint_type': value => $endpoint_type;
'cinder_client/api_version': value => $api_version;
'cinder_client/ca_file': value => $ca_file;
'cinder_client/cert_file': value => $cert_file;
'cinder_client/key_file': value => $key_file;
'cinder_client/insecure': value => $insecure;
}
}

View File

@ -0,0 +1,12 @@
---
features:
- |
The following parameters have been added to the ``magnum::clients::cinder``
class.
- ``endpoint_type``
- ``api_version``
- ``ca_file``
- ``cert_file``
- ``key_file``
- ``insecure``

View File

@ -7,19 +7,42 @@ describe 'magnum::clients::cinder' do
context 'with default parameters' do
let :params do
{ :region_name => 'RegionOne',
:endpoint_type => 'publicURL',
:ca_file => '<SERVICE DEFAULT>',
:cert_file => '<SERVICE DEFAULT>',
:key_file => '<SERVICE DEFAULT>',
:insecure => false,
}
end
it { is_expected.to contain_magnum_config('cinder_client/region_name').with_value('RegionOne') }
it { is_expected.to contain_magnum_config('cinder_client/endpoint_type').with_value('publicURL') }
it { is_expected.to contain_magnum_config('cinder_client/ca_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('cinder_client/cert_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('cinder_client/key_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('cinder_client/insecure').with_value(false) }
it { is_expected.to contain_magnum_config('cinder_client/api_version').with_value('<SERVICE DEFAULT>') }
end
context 'with specific parameters' do
let :params do
{ :region_name => 'RegionTwo',
{ :region_name => 'RegionTwo',
:endpoint_type => 'adminURL',
:api_version => 3,
:ca_file => '/etc/magnum/certs/ca.pem',
:cert_file => '/etc/magnum/certs/cert.pem',
:key_file => '/etc/magnum/certs/pri.key',
:insecure => true,
}
end
it { is_expected.to contain_magnum_config('cinder_client/region_name').with_value('RegionTwo') }
it { is_expected.to contain_magnum_config('cinder_client/endpoint_type').with_value('adminURL') }
it { is_expected.to contain_magnum_config('cinder_client/ca_file').with_value('/etc/magnum/certs/ca.pem') }
it { is_expected.to contain_magnum_config('cinder_client/cert_file').with_value('/etc/magnum/certs/cert.pem') }
it { is_expected.to contain_magnum_config('cinder_client/key_file').with_value('/etc/magnum/certs/pri.key') }
it { is_expected.to contain_magnum_config('cinder_client/insecure').with_value(true) }
it { is_expected.to contain_magnum_config('cinder_client/api_version').with_value(3) }
end
end