Use native support to define RequestHeader statement

... instead of injecting it by vhost_custom_fragment.

Depends-on: https://review.opendev.org/821082
Change-Id: I684e077d03b318cef01688c1b11ea37d7fc2f664
This commit is contained in:
Takashi Kajinami 2021-12-09 00:22:26 +09:00
parent 64d8a691fb
commit a06217b838
6 changed files with 36 additions and 7 deletions

View File

@ -93,6 +93,10 @@
# (optional) Name of the WSGI process display-name.
# Defaults to undef
#
# [*request_headers*]
# (optional) Modifies collected request headers in various ways.
# Defaults to undef
#
# == Dependencies
#
# requires Class['apache'] & Class['heat']
@ -125,6 +129,7 @@ define heat::wsgi::apache (
$error_log_file = undef,
$custom_wsgi_process_options = {},
$wsgi_process_display_name = undef,
$request_headers = undef,
) {
if $title !~ /^api(|_cfn)$/ {
fail('The valid options are api, api_cfn')
@ -174,5 +179,6 @@ define heat::wsgi::apache (
access_log_file => $access_log_file,
access_log_format => $access_log_format,
error_log_file => $error_log_file,
request_headers => $request_headers,
}
}

View File

@ -89,6 +89,10 @@
# (optional) Additional vhost configuration, if applicable.
# Defaults to undef
#
# [*request_headers*]
# (optional) Modifies collected request headers in various ways.
# Defaults to undef
#
# == Dependencies
#
# requires Class['apache'] & Class['heat']
@ -121,6 +125,7 @@ class heat::wsgi::apache_api (
$custom_wsgi_process_options = {},
$wsgi_process_display_name = undef,
$vhost_custom_fragment = undef,
$request_headers = undef,
) {
if $ssl == undef {
@ -150,5 +155,6 @@ class heat::wsgi::apache_api (
error_log_file => $error_log_file,
wsgi_process_display_name => $wsgi_process_display_name,
vhost_custom_fragment => $vhost_custom_fragment,
request_headers => $request_headers,
}
}

View File

@ -88,7 +88,11 @@
# [*vhost_custom_fragment*]
# (optional) Passes a string of custom configuration
# directives to be placed at the end of the vhost configuration.
# Default: 'RequestHeader set Content-Type "application/json"'
# Defaults to undef
#
# [*request_headers*]
# (optional) Modifies collected request headers in various ways.
# Defaults to ['set Content-Type "application/json"']
#
# == Dependencies
#
@ -121,8 +125,9 @@ class heat::wsgi::apache_api_cfn (
$error_log_file = undef,
$custom_wsgi_process_options = {},
$wsgi_process_display_name = undef,
$vhost_custom_fragment = undef,
# Enforce content-type, see https://bugs.launchpad.net/tripleo/+bug/1641589
$vhost_custom_fragment = 'RequestHeader set Content-Type "application/json"',
$request_headers = ['set Content-Type "application/json"'],
) {
if $ssl == undef {
@ -130,10 +135,6 @@ class heat::wsgi::apache_api_cfn (
}
$ssl_real = pick($ssl, true)
# See custom fragment below
include apache
include apache::mod::headers
validate_legacy(Integer, 'validate_integer', $port)
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1396553
@ -167,5 +168,6 @@ class heat::wsgi::apache_api_cfn (
access_log_format => $access_log_format,
error_log_file => $error_log_file,
wsgi_process_display_name => $wsgi_process_display_name,
request_headers => $request_headers,
}
}

View File

@ -0,0 +1,13 @@
---
features:
- |
Now puppet-heat supports overiding ``RequestHeader`` statements in apache
vhost configuration. Use the new ``request_headers`` parameter to define
the configuration value.
upgrade:
- |
Default value of ``heat::wsgi::apache_api_cfn::vhost_custom_fragment`` has
been updated to ``undef`` and now the new ``request_headers`` parameter
is used to define the default ``RequestHeader`` statement. Please update
these parameters accordingly.

View File

@ -24,7 +24,8 @@ describe 'heat::wsgi::apache_api_cfn' do
:custom_wsgi_process_options => {},
:access_log_file => false,
:access_log_format => false,
:vhost_custom_fragment => 'RequestHeader set Content-Type "application/json"',)
:vhost_custom_fragment => nil,
:request_headers => ['set Content-Type "application/json"'],)
}
end
end

View File

@ -30,6 +30,7 @@ describe 'heat::wsgi::apache' do
'wsgi_script_dir' => platform_params[:wsgi_script_dir],
'wsgi_script_file' => "heat_#{title}",
'allow_encoded_slashes' => 'on',
'request_headers' => nil,
)}
it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") }
end