Merge "Expose headers option of apache::vhost"

This commit is contained in:
Zuul 2022-07-30 14:13:04 +00:00 committed by Gerrit Code Review
commit 92e60c353a
3 changed files with 27 additions and 4 deletions

View File

@ -86,6 +86,14 @@
# { python-path => '/my/python/virtualenv' }
# Defaults to {}
#
# [*headers*]
# (optional) Headers for the vhost.
# Defaults to undef
#
# [*request_headers*]
# (optional) Modifies collected request headers in various ways.
# Defaults to undef
#
# == Dependencies
#
# requires Class['apache'] & Class['cloudkitty']
@ -117,6 +125,8 @@ class cloudkitty::wsgi::apache (
$access_log_format = false,
$error_log_file = undef,
$custom_wsgi_process_options = {},
$headers = undef,
$request_headers = undef,
) {
include cloudkitty::deps
@ -148,6 +158,8 @@ class cloudkitty::wsgi::apache (
wsgi_script_dir => $::cloudkitty::params::cloudkitty_wsgi_script_path,
wsgi_script_file => 'app',
wsgi_script_source => $::cloudkitty::params::cloudkitty_wsgi_script_source,
headers => $headers,
request_headers => $request_headers,
custom_wsgi_process_options => $custom_wsgi_process_options,
access_log_file => $access_log_file,
access_log_format => $access_log_format,

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``cloudkitty::wsgi::apache`` class now supports customizing
request/response headers added by apache.

View File

@ -19,13 +19,15 @@ describe 'cloudkitty::wsgi::apache' do
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => '/usr/bin/cloudkitty-api',
:headers => nil,
:request_headers => nil,
:custom_wsgi_process_options => {},
:access_log_file => false,
:access_log_format => false,
)}
end
context 'when overriding parameters using different ports' do
context 'when overriding parameters' do
let :params do
{
:servername => 'dummy.host',
@ -34,12 +36,14 @@ describe 'cloudkitty::wsgi::apache' do
:ssl => true,
:wsgi_process_display_name => 'cloudkitty',
:workers => 37,
:access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log',
:custom_wsgi_process_options => {
'python_path' => '/my/python/admin/path',
},
:access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log'
:headers => ['set X-XSS-Protection "1; mode=block"'],
:request_headers => ['set Content-Type "application/json"'],
}
end
it { is_expected.to contain_class('cloudkitty::params') }
@ -59,6 +63,8 @@ describe 'cloudkitty::wsgi::apache' do
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => '/usr/bin/cloudkitty-api',
:headers => ['set X-XSS-Protection "1; mode=block"'],
:request_headers => ['set Content-Type "application/json"'],
:custom_wsgi_process_options => {
'python_path' => '/my/python/admin/path',
},