dashboard: bring specific vhost flexibility

Signed-off-by: Dimitri Savineau <dimitri.savineau@enovance.com>
This commit is contained in:
Dimitri Savineau 2014-10-23 17:41:44 -04:00
parent 773ba6c5da
commit b11be44ef5
2 changed files with 24 additions and 2 deletions

View File

@ -93,6 +93,7 @@ class cloud::dashboard(
$ssl_forward = false,
$os_endpoint_type = undef,
$allowed_hosts = $::fqdn,
$vhost_extra_params = {},
) {
# We build the param needed for horizon class
@ -104,10 +105,12 @@ class cloud::dashboard(
} else {
$setenvif = []
}
$vhost_extra_params = {
$extra_params = {
'add_listen' => true,
'setenvif' => $setenvif
}
$vhost_extra_params_real = merge ($vhost_extra_params, $extra_params)
ensure_resource('class', 'apache', {
default_vhost => false
})
@ -128,7 +131,7 @@ class cloud::dashboard(
horizon_cert => $horizon_cert,
horizon_key => $horizon_key,
horizon_ca => $horizon_ca,
vhost_extra_params => $vhost_extra_params,
vhost_extra_params => $vhost_extra_params_real,
openstack_endpoint_type => $os_endpoint_type,
allowed_hosts => $allowed_hosts,
}

View File

@ -60,6 +60,25 @@ describe 'cloud::dashboard' do
is_expected.to contain_class('apache').with(:default_vhost => false)
end
context 'with custom apache2 vhost parameters' do
before do
params.merge!(
:vhost_extra_params => {
'ssl_protocol' => 'all -SSLv3 -SSLv2'
})
end
it 'configure horizon with custom vhost configuration' do
is_expected.to contain_class('horizon').with(
:vhost_extra_params => {
'add_listen' => true ,
'setenvif' => ['X-Forwarded-Proto https HTTPS=1'],
'ssl_protocol' => 'all -SSLv3 -SSLv2'
},
)
end
end
context 'with multiple allowed_hosts' do
before do
params.merge!(:allowed_hosts => ['horizon.openstack.org', 'vip.openstack.org'])