Add auth_strategy configuration

Added missing auth_strategy configuration and keystone authtoken
initialization to the API service.

Change-Id: Ic38d4f9f9a8e69ffcee6ccc4bba9a9ab0f161d0e
This commit is contained in:
Brent Eagles 2017-01-30 16:06:41 -03:30
parent c7b4060c72
commit 2ee0e421d1
3 changed files with 34 additions and 1 deletions

View File

@ -22,6 +22,10 @@
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*auth_strategy*]
# (optional) set authentication mechanism
# Defaults to 'keystone'
#
# [*sync_db*]
# (optional) Run octavia-db-manage upgrade head on api nodes after installing the package.
# Defaults to false
@ -32,6 +36,7 @@ class octavia::api (
$package_ensure = 'present',
$host = '0.0.0.0',
$port = '9876',
$auth_strategy = 'keystone',
$sync_db = false,
) inherits octavia::params {
@ -39,6 +44,10 @@ class octavia::api (
include ::octavia::policy
include ::octavia::db
if $auth_strategy == 'keystone' {
include ::octavia::keystone::authtoken
}
package { 'octavia-api':
ensure => $package_ensure,
name => $::octavia::params::api_package_name,
@ -69,6 +78,7 @@ class octavia::api (
octavia_config {
'DEFAULT/host' : value => $host;
'DEFAULT/port' : value => $port;
'DEFAULT/auth_strategy' : value => $auth_strategy;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- support for configuring auth_strategy for the Octavia api service has
been added and the keystone authtoken support properly initialized.

View File

@ -4,7 +4,11 @@ describe 'octavia::api' do
let :pre_condition do
"class { 'octavia': }
include ::octavia::db"
include ::octavia::db
class { '::octavia::keystone::authtoken':
password => 'password';
}
"
end
let :params do
@ -21,6 +25,7 @@ describe 'octavia::api' do
it { is_expected.to contain_class('octavia::deps') }
it { is_expected.to contain_class('octavia::params') }
it { is_expected.to contain_class('octavia::policy') }
it { is_expected.to contain_class('octavia::keystone::authtoken') }
it 'installs octavia-api package' do
is_expected.to contain_package('octavia-api').with(
@ -30,6 +35,20 @@ describe 'octavia::api' do
)
end
context 'when not parameters are defined' do
before do
params.clear()
end
it 'configures with default values' do
is_expected.to contain_octavia_config('DEFAULT/host').with_value( '0.0.0.0' )
is_expected.to contain_octavia_config('DEFAULT/port').with_value( '9876' )
is_expected.to contain_octavia_config('DEFAULT/auth_strategy').with_value( 'keystone' )
end
it 'does not sync the database' do
is_expected.not_to contain_class('octavia::db::sync')
end
end
it 'configures bind_host and bind_port' do
is_expected.to contain_octavia_config('DEFAULT/host').with_value( params[:host] )
is_expected.to contain_octavia_config('DEFAULT/port').with_value( params[:port] )