Add option to enable Aodh's SSL middleware

Aodh is now using the HTTPProxyToWSGI middleware from
oslo.middlware in its default api-paste configuration [1]. This commit
gives us the ability to enable/disable that middlware.

[1] If2ada8a94c8e1ceacd4509605b4cd766a78f71d5

Change-Id: I0981e152700ed4511b797011ebe18e857c1fed71
This commit is contained in:
Juan Antonio Osorio Robles 2016-10-10 12:02:32 +03:00 committed by Emilien Macchi
parent d3b12f6937
commit e092f1ff8b
3 changed files with 21 additions and 0 deletions

View File

@ -39,6 +39,11 @@
# (optional) Type of authentication to be used.
# Defaults to 'keystone'
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
# = DEPRECATED PARAMETERS
#
# [*keystone_identity_uri*]
@ -90,6 +95,7 @@ class aodh::api (
$service_name = $::aodh::params::api_service_name,
$sync_db = false,
$auth_strategy = 'keystone',
$enable_proxy_headers_parsing = $::os_service_default,
# DEPRECATED PARAMETERS
$keystone_identity_uri = undef,
$keystone_user = undef,
@ -202,4 +208,7 @@ as a standalone service, or httpd for being run by a httpd server")
'api/port': value => $port;
}
oslo::middleware { 'aodh_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
}
}

View File

@ -0,0 +1,4 @@
---
features:
- This adds the enable_proxy_headers parsing option which is used by the
http_proxy_to_wsgi middleware.

View File

@ -33,6 +33,7 @@ describe 'aodh::api' do
it 'configures api' do
is_expected.to contain_aodh_config('api/host').with_value( params[:host] )
is_expected.to contain_aodh_config('api/port').with_value( params[:port] )
is_expected.to contain_aodh_config('oslo_middleware/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
@ -63,6 +64,13 @@ describe 'aodh::api' do
it { is_expected.to contain_class('aodh::db::sync') }
end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })
end
it { is_expected.to contain_aodh_config('oslo_middleware/enable_proxy_headers_parsing').with_value(true) }
end
context 'with deprecated parameters' do
before do