Add support for multiple WSGI script aliases
This patch adds a new parameter named custom_wsgi_script_aliases to the openstacklib::wsgi::apache class. This can be used to specify extra WSGI script alias statements for the apache::vhost resource which is merged with the default one calculated using $path, $wsgi_script_dir and $wsgi_script_file. This is the final piece to be able to move keystone::wsgi::apache over to using openstacklib::wsgi::apache. Change-Id: I31096140a6f355ec99496053fb06ce6c73094180
This commit is contained in:
@@ -146,6 +146,12 @@
|
||||
# { python-path => '/my/python/virtualenv' }
|
||||
# Defaults to {}
|
||||
#
|
||||
# [*custom_wsgi_script_aliases*]
|
||||
# (Optional) Pass a hash with any extra WSGI script aliases that you want
|
||||
# to load for the same vhost, this is then combined with the default
|
||||
# script alias built usin $path, $wsgi_script_dir and $wsgi_script_file.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*vhost_custom_fragment*]
|
||||
# (Optional) Passes a string of custom configuration
|
||||
# directives to be placed at the end of the vhost configuration.
|
||||
@@ -220,6 +226,7 @@ define openstacklib::wsgi::apache (
|
||||
$wsgi_chunked_request = undef,
|
||||
$headers = undef,
|
||||
$custom_wsgi_process_options = {},
|
||||
$custom_wsgi_script_aliases = undef,
|
||||
$vhost_custom_fragment = undef,
|
||||
$allow_encoded_slashes = undef,
|
||||
$access_log_file = false,
|
||||
@@ -268,7 +275,14 @@ define openstacklib::wsgi::apache (
|
||||
},
|
||||
$custom_wsgi_process_options,
|
||||
)
|
||||
$wsgi_script_aliases = hash([$path_real,"${wsgi_script_dir}/${wsgi_script_file}"])
|
||||
|
||||
$wsgi_script_aliases_default = hash([$path_real,"${wsgi_script_dir}/${wsgi_script_file}"])
|
||||
|
||||
if $custom_wsgi_script_aliases {
|
||||
$wsgi_script_aliases_real = merge($wsgi_script_aliases_default, $custom_wsgi_script_aliases)
|
||||
} else {
|
||||
$wsgi_script_aliases_real = $wsgi_script_aliases_default
|
||||
}
|
||||
|
||||
::apache::vhost { $service_name:
|
||||
ensure => 'present',
|
||||
@@ -291,7 +305,7 @@ define openstacklib::wsgi::apache (
|
||||
wsgi_daemon_process => $wsgi_daemon_process,
|
||||
wsgi_daemon_process_options => $wsgi_daemon_process_options,
|
||||
wsgi_process_group => $wsgi_process_group,
|
||||
wsgi_script_aliases => $wsgi_script_aliases,
|
||||
wsgi_script_aliases => $wsgi_script_aliases_real,
|
||||
wsgi_application_group => $wsgi_application_group,
|
||||
wsgi_pass_authorization => $wsgi_pass_authorization,
|
||||
wsgi_chunked_request => $wsgi_chunked_request,
|
||||
|
@@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
openstacklib::wsgi::apache now has a parameter named custom_wsgi_script_aliases
|
||||
which can be used to add more WSGI script alises to the apache::vhost resource.
|
||||
These additional WSGI script aliases is added upon the default script alias which
|
||||
is $path combined with $wsgi_script_dir and $wsgi_script_file.
|
@@ -101,28 +101,30 @@ describe 'openstacklib::wsgi::apache' do
|
||||
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',
|
||||
:wsgi_pass_authorization => 'On',
|
||||
:wsgi_chunked_request => 'On',
|
||||
:headers => 'set X-Frame-Options "DENY"',
|
||||
: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',
|
||||
:allow_encoded_slashes => 'on',
|
||||
:access_log_file => '/var/log/httpd/access_log',
|
||||
:access_log_syslog => 'syslog:local0',
|
||||
:access_log_format => 'some format',
|
||||
:error_log_file => '/var/log/httpd/error_log',
|
||||
:error_log_syslog => 'syslog:local0'
|
||||
:wsgi_script_dir => '/var/www/cgi-bin/keystone',
|
||||
:wsgi_script_file => 'main',
|
||||
:wsgi_script_source => '/usr/share/keystone/keystone.wsgi',
|
||||
:wsgi_pass_authorization => 'On',
|
||||
:wsgi_chunked_request => 'On',
|
||||
:custom_wsgi_script_aliases => { '/admin' => '/var/www/cgi-bin/keystone/admin' },
|
||||
:headers => 'set X-Frame-Options "DENY"',
|
||||
: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',
|
||||
:allow_encoded_slashes => 'on',
|
||||
:access_log_file => '/var/log/httpd/access_log',
|
||||
:access_log_syslog => 'syslog:local0',
|
||||
:access_log_format => 'some format',
|
||||
:error_log_file => '/var/log/httpd/error_log',
|
||||
:error_log_syslog => 'syslog:local0'
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_apache__vhost('keystone_wsgi').with(
|
||||
'servername' => 'dummy.host',
|
||||
'ip' => '10.42.51.1',
|
||||
@@ -138,7 +140,10 @@ describe 'openstacklib::wsgi::apache' do
|
||||
'display-name' => 'keystone_wsgi',
|
||||
},
|
||||
'wsgi_process_group' => 'keystone_wsgi',
|
||||
'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone/main" },
|
||||
'wsgi_script_aliases' => {
|
||||
'/' => '/var/www/cgi-bin/keystone/main',
|
||||
'/admin' => '/var/www/cgi-bin/keystone/admin',
|
||||
},
|
||||
'wsgi_application_group' => '%{GLOBAL}',
|
||||
'wsgi_pass_authorization' => 'On',
|
||||
'wsgi_chunked_request' => 'On',
|
||||
|
Reference in New Issue
Block a user