Add enable_proxy_headers_parsing option

The patch enables paste middleware to handle SSL requests through
HTTPProxyToWSGI middleware.

Change-Id: Ifbed564e234303a4abbc5d2a90266c8c34e6516c
This commit is contained in:
ZhongShengping 2016-10-28 20:19:16 +08:00
parent e72ae32c08
commit a891cba1ae
3 changed files with 24 additions and 0 deletions

View File

@ -45,6 +45,11 @@
# to make mistral-api be a web app using apache mod_wsgi. # to make mistral-api be a web app using apache mod_wsgi.
# Defaults to '$::mistral::params::api_service_name' # Defaults to '$::mistral::params::api_service_name'
# #
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
class mistral::api ( class mistral::api (
$allow_action_execution_deletion = $::os_service_default, $allow_action_execution_deletion = $::os_service_default,
$api_workers = $::os_workers, $api_workers = $::os_workers,
@ -54,6 +59,7 @@ class mistral::api (
$manage_service = true, $manage_service = true,
$package_ensure = present, $package_ensure = present,
$service_name = $::mistral::params::api_service_name, $service_name = $::mistral::params::api_service_name,
$enable_proxy_headers_parsing = $::os_service_default,
) inherits mistral::params { ) inherits mistral::params {
include ::mistral::params include ::mistral::params
@ -113,4 +119,8 @@ as a standalone service, or httpd for being run by a httpd server")
'api/allow_action_execution_deletion' : value => $allow_action_execution_deletion; 'api/allow_action_execution_deletion' : value => $allow_action_execution_deletion;
} }
oslo::middleware { 'mistral_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

@ -8,6 +8,7 @@ describe 'mistral::api' do
:manage_service => true, :manage_service => true,
:bind_host => '127.0.0.1', :bind_host => '127.0.0.1',
:bind_port => '1234', :bind_port => '1234',
:enable_proxy_headers_parsing => false,
:allow_action_execution_deletion => false} :allow_action_execution_deletion => false}
end end
@ -21,6 +22,7 @@ describe 'mistral::api' do
it { is_expected.to contain_mistral_config('api/api_workers').with_value( params[:api_workers] ) } it { is_expected.to contain_mistral_config('api/api_workers').with_value( params[:api_workers] ) }
it { is_expected.to contain_mistral_config('api/host').with_value( params[:bind_host] ) } it { is_expected.to contain_mistral_config('api/host').with_value( params[:bind_host] ) }
it { is_expected.to contain_mistral_config('api/port').with_value( params[:bind_port] ) } it { is_expected.to contain_mistral_config('api/port').with_value( params[:bind_port] ) }
it { is_expected.to contain_mistral_config('oslo_middleware/enable_proxy_headers_parsing').with_value( params[:enable_proxy_headers_parsing] ) }
it { is_expected.to contain_mistral_config('api/allow_action_execution_deletion').with_value( params[:allow_action_execution_deletion] ) } it { is_expected.to contain_mistral_config('api/allow_action_execution_deletion').with_value( params[:allow_action_execution_deletion] ) }
end end
@ -46,6 +48,14 @@ describe 'mistral::api' do
end end
end end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })
end
it { is_expected.to contain_mistral_config('oslo_middleware/enable_proxy_headers_parsing').with_value( params[:enable_proxy_headers_parsing] ) }
end
context 'with disabled service managing' do context 'with disabled service managing' do
before do before do
params.merge!({ params.merge!({