Accept array or hash for enable_provider_drivers
The [api_settings] enable_provider_drivers parameter is DictOpt and accepts a string value which represents a dictionary. This change allows using array or hash for this parameter so that users can use a more "native" type to define its value. Change-Id: Icfa01a6cba5f4eda68d51ec2740f24fbc049f6e2
This commit is contained in:
parent
39e9c32801
commit
270d33d543
@ -180,6 +180,12 @@ class octavia::api (
|
||||
include octavia::db::sync
|
||||
}
|
||||
|
||||
if $provider_drivers =~ Hash {
|
||||
$provider_drivers_real = join(join_keys_to_values($provider_drivers, ':'), ',')
|
||||
} else {
|
||||
$provider_drivers_real = join(any2array($provider_drivers), ',')
|
||||
}
|
||||
|
||||
octavia_config {
|
||||
'api_settings/bind_host': value => $host;
|
||||
'api_settings/bind_port': value => $port;
|
||||
@ -189,7 +195,7 @@ class octavia::api (
|
||||
'api_settings/api_v2_enabled': value => $api_v2_enabled;
|
||||
'api_settings/allow_tls_terminated_listeners': value => $allow_tls_terminated_listeners;
|
||||
'api_settings/default_provider_driver': value => $default_provider_driver;
|
||||
'api_settings/enabled_provider_drivers': value => $provider_drivers;
|
||||
'api_settings/enabled_provider_drivers': value => $provider_drivers_real;
|
||||
'api_settings/pagination_max_limit': value => $pagination_max_limit;
|
||||
'api_settings/healthcheck_enabled': value => $healthcheck_enabled;
|
||||
'api_settings/healthcheck_refresh_interval': value => $healthcheck_refresh_interval;
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The ``octavia::api::provider_drivers`` parameter now supports array or hash
|
||||
value, and the given value is conveted to correctly formatted string when
|
||||
being put into octavia.conf.
|
@ -12,7 +12,7 @@ describe 'octavia::api' do
|
||||
:api_v2_enabled => true,
|
||||
:allow_tls_terminated_listeners => false,
|
||||
:default_provider_driver => 'ovn',
|
||||
:provider_drivers => { 'amphora' => 'Octavia Amphora Driver', 'ovn' => 'Octavia OVN driver' },
|
||||
:provider_drivers => 'amphora:Octavia Amphora Driver,ovn:Octavia OVN driver',
|
||||
:pagination_max_limit => '1000',
|
||||
:healthcheck_enabled => true,
|
||||
:healthcheck_refresh_interval => 5,
|
||||
@ -74,7 +74,7 @@ describe 'octavia::api' do
|
||||
end
|
||||
end
|
||||
|
||||
it 'configures bind_host and bind_port' do
|
||||
it 'configures parameters' do
|
||||
is_expected.to contain_octavia_config('api_settings/bind_host').with_value( params[:host] )
|
||||
is_expected.to contain_octavia_config('api_settings/bind_port').with_value( params[:port] )
|
||||
is_expected.to contain_octavia_config('api_settings/api_handler').with_value( params[:api_handler] )
|
||||
@ -179,6 +179,36 @@ describe 'octavia::api' do
|
||||
.with_value('TLSv1')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with provider_drivers in array' do
|
||||
before do
|
||||
params.merge!({
|
||||
:provider_drivers => [
|
||||
'amphora:Octavia Amphora driver',
|
||||
'ovn:Octavia OVN driver'
|
||||
]
|
||||
})
|
||||
end
|
||||
it 'configures parameters' do
|
||||
is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers')\
|
||||
.with_value('amphora:Octavia Amphora driver,ovn:Octavia OVN driver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with provider_drivers in hash' do
|
||||
before do
|
||||
params.merge!({
|
||||
:provider_drivers => {
|
||||
'amphora' => 'Octavia Amphora driver',
|
||||
'ovn' => 'Octavia OVN driver'
|
||||
}
|
||||
})
|
||||
end
|
||||
it 'configures parameters' do
|
||||
is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers')\
|
||||
.with_value('amphora:Octavia Amphora driver,ovn:Octavia OVN driver')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'octavia-api wsgi' do
|
||||
|
Loading…
Reference in New Issue
Block a user