Allow to path custom fragment to vhost

Add possibility to pass custom_fragment to apache::vhost
  in order to provide lines, that are not supported by module.
  (for example LimitRequestFieldSize for keystone)

Change-Id: Ib199dc75c17de0bcdc385afcc33cb3854668a1b2
This commit is contained in:
vsaienko 2015-09-01 16:42:26 +03:00
parent 745dccbfcd
commit 670e2de5ad
2 changed files with 67 additions and 23 deletions

View File

@ -115,30 +115,36 @@
# (optional) The source of the WSGI script.
# Defaults to undef
#
# [*vhost_custom_fragment*]
# (optional) Passes a string of custom configuration
# directives to be placed at the end of the vhost configuration.
# Defaults to undef.
#
define openstacklib::wsgi::apache (
$service_name = $name,
$bind_host = undef,
$bind_port = undef,
$group = undef,
$path = '/',
$priority = '10',
$servername = $::fqdn,
$ssl = false,
$ssl_ca = undef,
$ssl_cert = undef,
$ssl_certs_dir = undef,
$ssl_chain = undef,
$ssl_crl = undef,
$ssl_crl_path = undef,
$ssl_key = undef,
$threads = $::processorcount,
$user = undef,
$workers = 1,
$wsgi_daemon_process = $name,
$wsgi_process_group = $name,
$wsgi_script_dir = undef,
$wsgi_script_file = undef,
$wsgi_script_source = undef,
$service_name = $name,
$bind_host = undef,
$bind_port = undef,
$group = undef,
$path = '/',
$priority = '10',
$servername = $::fqdn,
$ssl = false,
$ssl_ca = undef,
$ssl_cert = undef,
$ssl_certs_dir = undef,
$ssl_chain = undef,
$ssl_crl = undef,
$ssl_crl_path = undef,
$ssl_key = undef,
$threads = $::processorcount,
$user = undef,
$workers = 1,
$wsgi_daemon_process = $name,
$wsgi_process_group = $name,
$wsgi_script_dir = undef,
$wsgi_script_file = undef,
$wsgi_script_source = undef,
$vhost_custom_fragment = undef,
) {
include ::apache
@ -198,6 +204,7 @@ define openstacklib::wsgi::apache (
wsgi_daemon_process_options => $wsgi_daemon_process_options,
wsgi_process_group => $wsgi_process_group,
wsgi_script_aliases => $wsgi_script_aliases,
custom_fragment => $vhost_custom_fragment,
require => File[$service_name],
}

View File

@ -86,6 +86,43 @@ describe 'openstacklib::wsgi::apache' do
it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
end
describe 'when overriding parameters' do
let :params do
{
:wsgi_script_dir => '/var/www/cgi-bin/keystone',
:wsgi_script_file => 'main',
:wsgi_script_source => '/usr/share/keystone/keystone.wsgi',
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:bind_port => 4142,
:user => 'keystone',
:group => 'keystone',
:ssl => false,
:workers => 37,
:vhost_custom_fragment => 'LimitRequestFieldSize 81900'
}
end
it { is_expected.to contain_apache__vhost('keystone_wsgi').with(
'servername' => 'dummy.host',
'ip' => '10.42.51.1',
'port' => '4142',
'docroot' => "/var/www/cgi-bin/keystone",
'ssl' => 'false',
'wsgi_daemon_process' => 'keystone_wsgi',
'wsgi_daemon_process_options' => {
'user' => 'keystone',
'group' => 'keystone',
'processes' => '37',
'threads' => '42',
},
'wsgi_process_group' => 'keystone_wsgi',
'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone/main" },
'require' => 'File[keystone_wsgi]',
'custom_fragment' => 'LimitRequestFieldSize 81900',
)}
end
end
context 'on RedHat platforms' do