Merge "Convert provider drivers to a json string for config file"

This commit is contained in:
Zuul 2019-03-20 17:49:20 +00:00 committed by Gerrit Code Review
commit 2d633a4869
2 changed files with 8 additions and 6 deletions

View File

@ -84,10 +84,6 @@ class octavia::api (
include ::octavia::policy include ::octavia::policy
include ::octavia::db include ::octavia::db
if !is_service_default($provider_drivers) {
validate_hash($provider_drivers)
}
if $auth_strategy == 'keystone' { if $auth_strategy == 'keystone' {
include ::octavia::keystone::authtoken include ::octavia::keystone::authtoken
} }
@ -131,6 +127,12 @@ class octavia::api (
include ::octavia::db::sync include ::octavia::db::sync
} }
if !is_service_default($provider_drivers) {
$provider_drivers_real = to_json($provider_drivers)
} else {
$provider_drivers_real = $provider_drivers
}
octavia_config { octavia_config {
'api_settings/bind_host': value => $host; 'api_settings/bind_host': value => $host;
'api_settings/bind_port': value => $port; 'api_settings/bind_port': value => $port;
@ -140,7 +142,7 @@ class octavia::api (
'api_settings/api_v2_enabled': value => $api_v2_enabled; 'api_settings/api_v2_enabled': value => $api_v2_enabled;
'api_settings/allow_tls_terminated_listeners': value => $allow_tls_terminated_listeners; 'api_settings/allow_tls_terminated_listeners': value => $allow_tls_terminated_listeners;
'api_settings/default_provider_driver': value => $default_provider_driver; '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;
} }
} }

View File

@ -67,7 +67,7 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/api_v2_enabled').with_value( params[:api_v2_enabled] ) is_expected.to contain_octavia_config('api_settings/api_v2_enabled').with_value( params[:api_v2_enabled] )
is_expected.to contain_octavia_config('api_settings/allow_tls_terminated_listeners').with_value( params[:allow_tls_terminated_listeners] ) is_expected.to contain_octavia_config('api_settings/allow_tls_terminated_listeners').with_value( params[:allow_tls_terminated_listeners] )
is_expected.to contain_octavia_config('api_settings/default_provider_driver').with_value( params[:default_provider_driver] ) is_expected.to contain_octavia_config('api_settings/default_provider_driver').with_value( params[:default_provider_driver] )
is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value( params[:provider_drivers] ) is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value( '{"amphora":"Octavia Amphora Driver","ovn":"Octavia OVN driver"}' )
end end
[{:enabled => true}, {:enabled => false}].each do |param_hash| [{:enabled => true}, {:enabled => false}].each do |param_hash|