Allow customizing apache::vhost parameters for SSL vhost
This change introduces the new ssl_extra_params parameter, which allows overriding apache::vhost parameters for SSL vhost. This parameter behaves like the existing extra_params parameter, but affects only the SSL vhost. When this parameter is NOT set, then the extra_params parameter affects both non-SSL vhost and SSL vhost. Change-Id: I88fc341f6970006b03cc796117e2fb8f46e87a52
This commit is contained in:
@@ -75,6 +75,11 @@
|
|||||||
# (optional) A hash of extra parameters for apache::wsgi class.
|
# (optional) A hash of extra parameters for apache::wsgi class.
|
||||||
# Defaults to {}
|
# Defaults to {}
|
||||||
#
|
#
|
||||||
|
# [*ssl_extra_params*]
|
||||||
|
# (optional) A hash of extra parameters for apache::wsgi class. This is used
|
||||||
|
# for SSL vhost and overrides $extra_params.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
# [*redirect_type*]
|
# [*redirect_type*]
|
||||||
# (optional) What type of redirect to use when redirecting an http request
|
# (optional) What type of redirect to use when redirecting an http request
|
||||||
# for a user. This should be either 'temp' or 'permanent'. Setting this value
|
# for a user. This should be either 'temp' or 'permanent'. Setting this value
|
||||||
@@ -115,6 +120,7 @@ class horizon::wsgi::apache (
|
|||||||
$vhost_conf_name = 'horizon_vhost',
|
$vhost_conf_name = 'horizon_vhost',
|
||||||
$vhost_ssl_conf_name = 'horizon_ssl_vhost',
|
$vhost_ssl_conf_name = 'horizon_ssl_vhost',
|
||||||
$extra_params = {},
|
$extra_params = {},
|
||||||
|
$ssl_extra_params = undef,
|
||||||
$redirect_type = 'permanent',
|
$redirect_type = 'permanent',
|
||||||
$root_url = $::horizon::params::root_url,
|
$root_url = $::horizon::params::root_url,
|
||||||
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
|
$root_path = "${::horizon::params::static_path}/openstack-dashboard",
|
||||||
@@ -274,26 +280,39 @@ class horizon::wsgi::apache (
|
|||||||
$redirectmatch_url_real = $root_url_real ? { '' => undef, '/' => undef, default => $redirect_url }
|
$redirectmatch_url_real = $root_url_real ? { '' => undef, '/' => undef, default => $redirect_url }
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_resource('apache::vhost', $vhost_conf_name, merge ($default_vhost_conf, $extra_params, {
|
ensure_resource('apache::vhost', $vhost_conf_name, merge(
|
||||||
wsgi_daemon_process => hash([$::horizon::params::wsgi_group, $wsgi_daemon_process_options])
|
$default_vhost_conf,
|
||||||
}, {
|
$extra_params,
|
||||||
redirectmatch_regexp => $redirectmatch_regexp_real,
|
{
|
||||||
redirectmatch_dest => $redirectmatch_url_real,
|
wsgi_daemon_process => hash([$::horizon::params::wsgi_group, $wsgi_daemon_process_options])
|
||||||
options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
|
},
|
||||||
}))
|
{
|
||||||
ensure_resource('apache::vhost', $vhost_ssl_conf_name, merge ($default_vhost_conf, $extra_params, {
|
redirectmatch_regexp => $redirectmatch_regexp_real,
|
||||||
wsgi_daemon_process => hash(['horizon-ssl', $wsgi_daemon_process_options]),
|
redirectmatch_dest => $redirectmatch_url_real,
|
||||||
}, {
|
options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
|
||||||
access_log_file => 'horizon_ssl_access.log',
|
}
|
||||||
error_log_file => 'horizon_ssl_error.log',
|
))
|
||||||
priority => $priority,
|
|
||||||
ssl => true,
|
|
||||||
port => $https_port,
|
$ssl_extra_params_real = pick_default($ssl_extra_params, $extra_params)
|
||||||
ensure => $ensure_ssl_vhost,
|
ensure_resource('apache::vhost', $vhost_ssl_conf_name, merge(
|
||||||
wsgi_process_group => 'horizon-ssl',
|
$default_vhost_conf,
|
||||||
redirectmatch_regexp => $root_url_real ? { '' => undef, '/' => undef, default => '^/$' },
|
$ssl_extra_params_real,
|
||||||
redirectmatch_dest => $root_url_real ? { '' => undef, '/' => undef, default => $root_url_real },
|
{
|
||||||
options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
|
wsgi_daemon_process => hash(['horizon-ssl', $wsgi_daemon_process_options]),
|
||||||
}))
|
},
|
||||||
|
{
|
||||||
|
access_log_file => 'horizon_ssl_access.log',
|
||||||
|
error_log_file => 'horizon_ssl_error.log',
|
||||||
|
priority => $priority,
|
||||||
|
ssl => true,
|
||||||
|
port => $https_port,
|
||||||
|
ensure => $ensure_ssl_vhost,
|
||||||
|
wsgi_process_group => 'horizon-ssl',
|
||||||
|
redirectmatch_regexp => $root_url_real ? { '' => undef, '/' => undef, default => '^/$' },
|
||||||
|
redirectmatch_dest => $root_url_real ? { '' => undef, '/' => undef, default => $root_url_real },
|
||||||
|
options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``horizon::wsgi::apache::ssl_extra_params`` parameter has been
|
||||||
|
added. This parameter affects only ssl vhost and overrides
|
||||||
|
the ``extra_params`` parameter when set.
|
@@ -227,7 +227,7 @@ describe 'horizon::wsgi::apache' do
|
|||||||
params.merge!({
|
params.merge!({
|
||||||
:extra_params => {
|
:extra_params => {
|
||||||
'add_listen' => false,
|
'add_listen' => false,
|
||||||
'docroot' => '/tmp'
|
'docroot' => '/tmp'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -236,6 +236,30 @@ describe 'horizon::wsgi::apache' do
|
|||||||
:add_listen => false,
|
:add_listen => false,
|
||||||
:docroot => '/tmp'
|
:docroot => '/tmp'
|
||||||
)}
|
)}
|
||||||
|
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||||
|
:add_listen => false,
|
||||||
|
:docroot => '/tmp'
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with ssl extra parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!({
|
||||||
|
:extra_params => {
|
||||||
|
'docroot' => '/root1'
|
||||||
|
},
|
||||||
|
:ssl_extra_params => {
|
||||||
|
'docroot' => '/root2'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_apache__vhost('horizon_vhost').with(
|
||||||
|
:docroot => '/root1'
|
||||||
|
)}
|
||||||
|
it { should contain_apache__vhost('horizon_ssl_vhost').with(
|
||||||
|
:docroot => '/root2'
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with root_url set to /' do
|
context 'with root_url set to /' do
|
||||||
|
Reference in New Issue
Block a user