From b11be44ef5dc9497406cb46948b1b83a5e1edce6 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 23 Oct 2014 17:41:44 -0400 Subject: [PATCH] dashboard: bring specific vhost flexibility Signed-off-by: Dimitri Savineau --- manifests/dashboard.pp | 7 +++++-- spec/classes/cloud_dashboard_spec.rb | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index 672eab48..4241fc9e 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -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, } diff --git a/spec/classes/cloud_dashboard_spec.rb b/spec/classes/cloud_dashboard_spec.rb index 42b96a78..92e243f7 100644 --- a/spec/classes/cloud_dashboard_spec.rb +++ b/spec/classes/cloud_dashboard_spec.rb @@ -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'])