Add oslo_middleware/enable_proxy_headers_parsing option
Change-Id: I59ce740ad85967e181da328e11d394cc1c029ab6
This commit is contained in:
parent
f66eea46e2
commit
e2b05c8956
|
@ -64,20 +64,26 @@
|
||||||
# (Optional) Number of API workers.
|
# (Optional) Number of API workers.
|
||||||
# Defaults to $::os_workers
|
# Defaults to $::os_workers
|
||||||
#
|
#
|
||||||
|
# [*enable_proxy_headers_parsing*]
|
||||||
|
# (optional) This determines if the HTTPProxyToWSGI
|
||||||
|
# middleware should parse the proxy headers or not.(boolean value)
|
||||||
|
# Defaults to $::os_service_default
|
||||||
|
#
|
||||||
class magnum::api(
|
class magnum::api(
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$enabled = true,
|
$enabled = true,
|
||||||
$manage_service = true,
|
$manage_service = true,
|
||||||
$service_name = $::magnum::params::api_service,
|
$service_name = $::magnum::params::api_service,
|
||||||
$port = '9511',
|
$port = '9511',
|
||||||
$host = '127.0.0.1',
|
$host = '127.0.0.1',
|
||||||
$max_limit = '1000',
|
$max_limit = '1000',
|
||||||
$sync_db = true,
|
$sync_db = true,
|
||||||
$auth_strategy = 'keystone',
|
$auth_strategy = 'keystone',
|
||||||
$enabled_ssl = false,
|
$enabled_ssl = false,
|
||||||
$ssl_cert_file = $::os_service_default,
|
$ssl_cert_file = $::os_service_default,
|
||||||
$ssl_key_file = $::os_service_default,
|
$ssl_key_file = $::os_service_default,
|
||||||
$workers = $::os_workers,
|
$workers = $::os_workers,
|
||||||
|
$enable_proxy_headers_parsing = $::os_service_default,
|
||||||
) inherits magnum::params {
|
) inherits magnum::params {
|
||||||
|
|
||||||
include magnum::deps
|
include magnum::deps
|
||||||
|
@ -149,4 +155,9 @@ class magnum::api(
|
||||||
if $auth_strategy == 'keystone' {
|
if $auth_strategy == 'keystone' {
|
||||||
include magnum::keystone::authtoken
|
include magnum::keystone::authtoken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oslo::middleware {'magnum_config':
|
||||||
|
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add support to configure the enable_proxy_headers_parsing parameter in the
|
||||||
|
oslo_middlware section.
|
|
@ -10,15 +10,16 @@ describe 'magnum::api' do
|
||||||
end
|
end
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{ :package_ensure => 'present',
|
{ :package_ensure => 'present',
|
||||||
:enabled => true,
|
:enabled => true,
|
||||||
:port => '9511',
|
:port => '9511',
|
||||||
:host => '127.0.0.1',
|
:host => '127.0.0.1',
|
||||||
:max_limit => '1000',
|
:max_limit => '1000',
|
||||||
:sync_db => 'true',
|
:sync_db => 'true',
|
||||||
:enabled_ssl => 'false',
|
:enabled_ssl => 'false',
|
||||||
:ssl_cert_file => '<SERVICE DEFAULT>',
|
:ssl_cert_file => '<SERVICE DEFAULT>',
|
||||||
:ssl_key_file => '<SERVICE DEFAULT>',
|
:ssl_key_file => '<SERVICE DEFAULT>',
|
||||||
|
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,6 +61,10 @@ describe 'magnum::api' do
|
||||||
is_expected.to contain_magnum_config('api/workers').with_value(facts[:os_workers])
|
is_expected.to contain_magnum_config('api/workers').with_value(facts[:os_workers])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_oslo__middleware('magnum_config').with(
|
||||||
|
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
|
||||||
|
)}
|
||||||
|
|
||||||
context 'when overriding parameters' do
|
context 'when overriding parameters' do
|
||||||
before :each do
|
before :each do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
|
@ -91,6 +96,18 @@ describe 'magnum::api' do
|
||||||
it { is_expected.to contain_magnum_config('api/ssl_cert_file').with_value(p[:ssl_cert_file]) }
|
it { is_expected.to contain_magnum_config('api/ssl_cert_file').with_value(p[:ssl_cert_file]) }
|
||||||
it { is_expected.to contain_magnum_config('api/ssl_key_file').with_value(p[:ssl_key_file]) }
|
it { is_expected.to contain_magnum_config('api/ssl_key_file').with_value(p[:ssl_key_file]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with oslo_middleware configured' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:enable_proxy_headers_parsing => true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_oslo__middleware('magnum_config').with(
|
||||||
|
:enable_proxy_headers_parsing => 'true',
|
||||||
|
)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'magnum-api wsgi' do
|
shared_examples 'magnum-api wsgi' do
|
||||||
|
|
Loading…
Reference in New Issue