Add api_handler option

Add the ability to configure the handler that the API communicates with.

Change-Id: I2afb1b31e94f7a25942c2cbd05f71ee6328a1909
This commit is contained in:
ZhongShengping 2017-09-14 15:48:38 +08:00
parent 240af51915
commit 0fdc4d39ab
3 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,10 @@
# (optional) set authentication mechanism
# Defaults to 'keystone'
#
# [*api_handler*]
# (optional) The handler that the API communicates with
# Defaults to $::os_service_default
#
# [*sync_db*]
# (optional) Run octavia-db-manage upgrade head on api nodes after installing the package.
# Defaults to false
@ -37,6 +41,7 @@ class octavia::api (
$host = '0.0.0.0',
$port = '9876',
$auth_strategy = 'keystone',
$api_handler = $::os_service_default,
$sync_db = false,
) inherits octavia::params {
@ -79,6 +84,7 @@ class octavia::api (
'api_settings/bind_host' : value => $host;
'api_settings/bind_port' : value => $port;
'api_settings/auth_strategy' : value => $auth_strategy;
'api_settings/api_handler' : value => $api_handler;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- Add new parameter "api_handler", the handler that the API
communicates with.

View File

@ -17,6 +17,7 @@ describe 'octavia::api' do
:package_ensure => 'latest',
:port => '9876',
:host => '0.0.0.0',
:api_handler => 'queue_producer',
}
end
@ -43,6 +44,7 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/bind_host').with_value( '0.0.0.0' )
is_expected.to contain_octavia_config('api_settings/bind_port').with_value( '9876' )
is_expected.to contain_octavia_config('api_settings/auth_strategy').with_value( 'keystone' )
is_expected.to contain_octavia_config('api_settings/api_handler').with_value('<SERVICE DEFAULT>')
end
it 'does not sync the database' do
is_expected.not_to contain_class('octavia::db::sync')
@ -52,6 +54,7 @@ describe 'octavia::api' do
it 'configures bind_host and bind_port' 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] )
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|