Merge "Expose headers option of apache::vhost"

This commit is contained in:
Zuul 2022-07-30 17:38:13 +00:00 committed by Gerrit Code Review
commit 73c888a69b
7 changed files with 49 additions and 22 deletions

View File

@ -66,9 +66,6 @@
# apache::vhost ssl parameters. # apache::vhost ssl parameters.
# Optional. Default to apache::vhost 'ssl_*' defaults. # Optional. Default to apache::vhost 'ssl_*' defaults.
# #
# [*vhost_custom_fragment*]
# (optional) Additional vhost configuration, if applicable.
#
# [*access_log_file*] # [*access_log_file*]
# The log file name for the virtualhost. # The log file name for the virtualhost.
# Optional. Defaults to false. # Optional. Defaults to false.
@ -93,10 +90,17 @@
# (optional) Name of the WSGI process display-name. # (optional) Name of the WSGI process display-name.
# Defaults to undef # Defaults to undef
# #
# [*headers*]
# (optional) Headers for the vhost.
# Defaults to undef
#
# [*request_headers*] # [*request_headers*]
# (optional) Modifies collected request headers in various ways. # (optional) Modifies collected request headers in various ways.
# Defaults to undef # Defaults to undef
# #
# [*vhost_custom_fragment*]
# (optional) Additional vhost configuration, if applicable.
#
# == Dependencies # == Dependencies
# #
# requires Class['apache'] & Class['heat'] # requires Class['apache'] & Class['heat']
@ -123,13 +127,14 @@ define heat::wsgi::apache (
$ssl_certs_dir = undef, $ssl_certs_dir = undef,
$threads = 1, $threads = 1,
$priority = '10', $priority = '10',
$vhost_custom_fragment = undef,
$access_log_file = false, $access_log_file = false,
$access_log_format = false, $access_log_format = false,
$error_log_file = undef, $error_log_file = undef,
$custom_wsgi_process_options = {}, $custom_wsgi_process_options = {},
$wsgi_process_display_name = undef, $wsgi_process_display_name = undef,
$headers = undef,
$request_headers = undef, $request_headers = undef,
$vhost_custom_fragment = undef,
) { ) {
if $title !~ /^api(|_cfn)$/ { if $title !~ /^api(|_cfn)$/ {
fail('The valid options are api, api_cfn') fail('The valid options are api, api_cfn')
@ -157,6 +162,7 @@ define heat::wsgi::apache (
ssl_key => $ssl_key, ssl_key => $ssl_key,
threads => $threads, threads => $threads,
user => $::heat::params::user, user => $::heat::params::user,
vhost_custom_fragment => $vhost_custom_fragment,
workers => $workers, workers => $workers,
wsgi_daemon_process => "heat_${title}", wsgi_daemon_process => "heat_${title}",
wsgi_process_display_name => $wsgi_process_display_name, wsgi_process_display_name => $wsgi_process_display_name,
@ -164,12 +170,12 @@ define heat::wsgi::apache (
wsgi_script_dir => $::heat::params::heat_wsgi_script_path, wsgi_script_dir => $::heat::params::heat_wsgi_script_path,
wsgi_script_file => "heat_${title}", wsgi_script_file => "heat_${title}",
wsgi_script_source => getvar("::heat::params::heat_${title}_wsgi_script_source"), wsgi_script_source => getvar("::heat::params::heat_${title}_wsgi_script_source"),
headers => $headers,
request_headers => $request_headers,
custom_wsgi_process_options => $custom_wsgi_process_options, custom_wsgi_process_options => $custom_wsgi_process_options,
allow_encoded_slashes => 'on', allow_encoded_slashes => 'on',
vhost_custom_fragment => $vhost_custom_fragment,
access_log_file => $access_log_file, access_log_file => $access_log_file,
access_log_format => $access_log_format, access_log_format => $access_log_format,
error_log_file => $error_log_file, error_log_file => $error_log_file,
request_headers => $request_headers,
} }
} }

View File

@ -85,14 +85,18 @@
# (optional) Name of the WSGI process display-name. # (optional) Name of the WSGI process display-name.
# Defaults to undef # Defaults to undef
# #
# [*vhost_custom_fragment*] # [*headers*]
# (optional) Additional vhost configuration, if applicable. # (optional) Headers for the vhost.
# Defaults to undef # Defaults to undef
# #
# [*request_headers*] # [*request_headers*]
# (optional) Modifies collected request headers in various ways. # (optional) Modifies collected request headers in various ways.
# Defaults to undef # Defaults to undef
# #
# [*vhost_custom_fragment*]
# (optional) Additional vhost configuration, if applicable.
# Defaults to undef
#
# == Dependencies # == Dependencies
# #
# requires Class['apache'] & Class['heat'] # requires Class['apache'] & Class['heat']
@ -124,8 +128,9 @@ class heat::wsgi::apache_api (
$error_log_file = undef, $error_log_file = undef,
$custom_wsgi_process_options = {}, $custom_wsgi_process_options = {},
$wsgi_process_display_name = undef, $wsgi_process_display_name = undef,
$vhost_custom_fragment = undef, $headers = undef,
$request_headers = undef, $request_headers = undef,
$vhost_custom_fragment = undef,
) { ) {
heat::wsgi::apache { 'api': heat::wsgi::apache { 'api':
@ -143,13 +148,14 @@ class heat::wsgi::apache_api (
ssl_crl => $ssl_crl, ssl_crl => $ssl_crl,
ssl_certs_dir => $ssl_certs_dir, ssl_certs_dir => $ssl_certs_dir,
threads => $threads, threads => $threads,
custom_wsgi_process_options => $custom_wsgi_process_options,
priority => $priority, priority => $priority,
access_log_file => $access_log_file, access_log_file => $access_log_file,
access_log_format => $access_log_format, access_log_format => $access_log_format,
error_log_file => $error_log_file, error_log_file => $error_log_file,
custom_wsgi_process_options => $custom_wsgi_process_options,
wsgi_process_display_name => $wsgi_process_display_name, wsgi_process_display_name => $wsgi_process_display_name,
vhost_custom_fragment => $vhost_custom_fragment, headers => $headers,
request_headers => $request_headers, request_headers => $request_headers,
vhost_custom_fragment => $vhost_custom_fragment,
} }
} }

View File

@ -85,15 +85,19 @@
# (optional) Name of the WSGI process display-name. # (optional) Name of the WSGI process display-name.
# Defaults to undef # Defaults to undef
# #
# [*vhost_custom_fragment*] # [*headers*]
# (optional) Passes a string of custom configuration # (optional) Headers for the vhost.
# directives to be placed at the end of the vhost configuration.
# Defaults to undef # Defaults to undef
# #
# [*request_headers*] # [*request_headers*]
# (optional) Modifies collected request headers in various ways. # (optional) Modifies collected request headers in various ways.
# Defaults to ['set Content-Type "application/json"'] # Defaults to ['set Content-Type "application/json"']
# #
# [*vhost_custom_fragment*]
# (optional) Passes a string of custom configuration
# directives to be placed at the end of the vhost configuration.
# Defaults to undef
#
# == Dependencies # == Dependencies
# #
# requires Class['apache'] & Class['heat'] # requires Class['apache'] & Class['heat']
@ -125,9 +129,10 @@ class heat::wsgi::apache_api_cfn (
$error_log_file = undef, $error_log_file = undef,
$custom_wsgi_process_options = {}, $custom_wsgi_process_options = {},
$wsgi_process_display_name = undef, $wsgi_process_display_name = undef,
$vhost_custom_fragment = undef, $headers = undef,
# Enforce content-type, see https://bugs.launchpad.net/tripleo/+bug/1641589 # Enforce content-type, see https://bugs.launchpad.net/tripleo/+bug/1641589
$request_headers = ['set Content-Type "application/json"'], $request_headers = ['set Content-Type "application/json"'],
$vhost_custom_fragment = undef,
) { ) {
validate_legacy(Integer, 'validate_integer', $port) validate_legacy(Integer, 'validate_integer', $port)
@ -157,12 +162,13 @@ class heat::wsgi::apache_api_cfn (
ssl_certs_dir => $ssl_certs_dir, ssl_certs_dir => $ssl_certs_dir,
threads => $threads, threads => $threads,
priority => $priority, priority => $priority,
vhost_custom_fragment => $vhost_custom_fragment,
custom_wsgi_process_options => $custom_wsgi_process_options,
access_log_file => $access_log_file, access_log_file => $access_log_file,
access_log_format => $access_log_format, access_log_format => $access_log_format,
error_log_file => $error_log_file, error_log_file => $error_log_file,
custom_wsgi_process_options => $custom_wsgi_process_options,
wsgi_process_display_name => $wsgi_process_display_name, wsgi_process_display_name => $wsgi_process_display_name,
headers => $headers,
request_headers => $request_headers, request_headers => $request_headers,
vhost_custom_fragment => $vhost_custom_fragment,
} }
} }

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``heat::wsgi::apache_api`` class and the ``heat::wsgi::apache_api_cfn``
class now support customizing response headers added by apache.

View File

@ -19,14 +19,15 @@ describe 'heat::wsgi::apache_api_cfn' do
:ssl_crl_path => nil, :ssl_crl_path => nil,
:ssl_certs_dir => nil, :ssl_certs_dir => nil,
:wsgi_process_display_name => nil, :wsgi_process_display_name => nil,
:vhost_custom_fragment => nil,
:threads => 1, :threads => 1,
:priority => 10, :priority => 10,
:headers => nil,
:request_headers => ['set Content-Type "application/json"'],
:custom_wsgi_process_options => {}, :custom_wsgi_process_options => {},
:access_log_file => false, :access_log_file => false,
:access_log_format => false, :access_log_format => false,
:vhost_custom_fragment => nil, )}
:request_headers => ['set Content-Type "application/json"'],)
}
end end
end end

View File

@ -22,10 +22,12 @@ describe 'heat::wsgi::apache_api' do
:vhost_custom_fragment => nil, :vhost_custom_fragment => nil,
:threads => 1, :threads => 1,
:priority => 10, :priority => 10,
:headers => nil,
:request_headers => nil,
:custom_wsgi_process_options => {}, :custom_wsgi_process_options => {},
:access_log_file => false, :access_log_file => false,
:access_log_format => false,) :access_log_format => false,
} )}
end end
end end

View File

@ -27,6 +27,7 @@ describe 'heat::wsgi::apache' do
'wsgi_script_dir' => platform_params[:wsgi_script_dir], 'wsgi_script_dir' => platform_params[:wsgi_script_dir],
'wsgi_script_file' => "heat_#{title}", 'wsgi_script_file' => "heat_#{title}",
'allow_encoded_slashes' => 'on', 'allow_encoded_slashes' => 'on',
'headers' => nil,
'request_headers' => nil, 'request_headers' => nil,
)} )}
end end