From 54097080e3a975c464f45ba43bb0b2a42641d50c Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Fri, 28 Oct 2016 20:11:21 +0800 Subject: [PATCH] Add enable_proxy_headers_parsing option The patch enables paste middleware to handle SSL requests through HTTPProxyToWSGI middleware. Change-Id: I367333809b7c2d9888b425d2db5e8033554db2c6 --- manifests/api.pp | 40 ++++++++++++------- ...proxy_header_parsing-1837e35d317e74f7.yaml | 4 ++ spec/classes/ironic_api_spec.rb | 9 +++++ 3 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 releasenotes/notes/add_enable_proxy_header_parsing-1837e35d317e74f7.yaml diff --git a/manifests/api.pp b/manifests/api.pp index dee906ac..35df585d 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -94,23 +94,29 @@ # undefined, tokens will instead be cached in-process. # Defaults to undef. # +# [*enable_proxy_headers_parsing*] +# (Optional) Enable paste middleware to handle SSL requests through +# HTTPProxyToWSGI middleware. +# Defaults to $::os_service_default. +# class ironic::api ( - $package_ensure = 'present', - $enabled = true, - $service_name = $::ironic::params::api_service, - $host_ip = '0.0.0.0', - $port = '6385', - $max_limit = '1000', - $workers = $::os_service_default, - $neutron_url = 'http://127.0.0.1:9696/', - $public_endpoint = $::os_service_default, + $package_ensure = 'present', + $enabled = true, + $service_name = $::ironic::params::api_service, + $host_ip = '0.0.0.0', + $port = '6385', + $max_limit = '1000', + $workers = $::os_service_default, + $neutron_url = 'http://127.0.0.1:9696/', + $public_endpoint = $::os_service_default, + $enable_proxy_headers_parsing = $::os_service_default, # DEPRECATED PARAMETERS - $identity_uri = undef, - $admin_tenant_name = undef, - $admin_user = undef, - $admin_password = undef, - $auth_uri = undef, - $memcached_servers = undef, + $identity_uri = undef, + $admin_tenant_name = undef, + $admin_user = undef, + $admin_password = undef, + $auth_uri = undef, + $memcached_servers = undef, ) inherits ironic::params { include ::ironic::deps @@ -200,4 +206,8 @@ Use 'ironic::api::authtoken::memcached_servers' parameter instead.") standalone service, or httpd for being run by a httpd server") } + oslo::middleware { 'ironic_config': + enable_proxy_headers_parsing => $enable_proxy_headers_parsing, + } + } diff --git a/releasenotes/notes/add_enable_proxy_header_parsing-1837e35d317e74f7.yaml b/releasenotes/notes/add_enable_proxy_header_parsing-1837e35d317e74f7.yaml new file mode 100644 index 00000000..3f798751 --- /dev/null +++ b/releasenotes/notes/add_enable_proxy_header_parsing-1837e35d317e74f7.yaml @@ -0,0 +1,4 @@ +--- +features: + - This adds the enable_proxy_headers parsing option which is used by the + http_proxy_to_wsgi middleware. diff --git a/spec/classes/ironic_api_spec.rb b/spec/classes/ironic_api_spec.rb index b6012a8b..229433c9 100644 --- a/spec/classes/ironic_api_spec.rb +++ b/spec/classes/ironic_api_spec.rb @@ -76,6 +76,7 @@ describe 'ironic::api' do is_expected.to contain_ironic_config('keystone_authtoken/memcached_servers').with_value('') is_expected.to contain_ironic_config('neutron/url').with_value('http://127.0.0.1:9696/') is_expected.to contain_ironic_config('keystone_authtoken/project_name').with_value(p[:admin_tenant_name]) + is_expected.to contain_ironic_config('oslo_middleware/enable_proxy_headers_parsing').with_value('') end context 'when overriding parameters' do @@ -105,6 +106,14 @@ describe 'ironic::api' do end end + context 'with enable_proxy_headers_parsing' do + before do + params.merge!({:enable_proxy_headers_parsing => true }) + end + + it { is_expected.to contain_ironic_config('oslo_middleware/enable_proxy_headers_parsing').with_value(true) } + end + context 'when running ironic-api in wsgi' do before do params.merge!({ :service_name => 'httpd' })