Merge pull request #664 from enovance/fix_allowed_host_horizon

dashboard: Allow multiple value for ALLOWED_HOST in horizon
This commit is contained in:
Emilien Macchi 2014-10-07 19:48:35 -04:00
commit e2899f5796
2 changed files with 36 additions and 3 deletions

View File

@ -91,7 +91,8 @@ class cloud::dashboard(
$horizon_key = undef,
$horizon_ca = undef,
$ssl_forward = false,
$os_endpoint_type = undef
$os_endpoint_type = undef,
$allowed_hosts = $::fqdn,
) {
# We build the param needed for horizon class
@ -133,6 +134,7 @@ class cloud::dashboard(
horizon_ca => $horizon_ca,
vhost_extra_params => $vhost_extra_params,
openstack_endpoint_type => $os_endpoint_type,
allowed_hosts => $allowed_hosts,
}
if ($::osfamily == 'Debian') {

View File

@ -34,7 +34,8 @@ describe 'cloud::dashboard' do
:api_eth => '10.0.0.1',
:ssl_forward => true,
:servername => 'horizon.openstack.org',
:os_endpoint_type => 'internalURL' }
:os_endpoint_type => 'internalURL',
:allowed_hosts => 'horizon.openstack.org'}
end
it 'configure horizon' do
@ -54,10 +55,40 @@ describe 'cloud::dashboard' do
'add_listen' => true ,
'setenvif' => ['X-Forwarded-Proto https HTTPS=1']
},
:openstack_endpoint_type => 'internalURL'
:openstack_endpoint_type => 'internalURL',
:allowed_hosts => 'horizon.openstack.org'
)
is_expected.to contain_class('apache').with(:default_vhost => false)
end
context 'with multiple allowed_hosts' do
before do
params.merge!(:allowed_hosts => ['horizon.openstack.org', 'vip.openstack.org'])
end
it 'configure horizon with multiple allowed hosts' do
is_expected.to contain_class('horizon').with(
:listen_ssl => false,
:secret_key => '/etc/ssl/secret',
:can_set_mount_point => 'False',
:fqdn => '10.0.0.1',
:bind_address => '10.0.0.1',
:servername => 'horizon.openstack.org',
:swift => true,
:cache_server_ip => false,
:keystone_url => 'http://keystone.openstack.org:5000/v2.0',
:django_debug => true,
:neutron_options => { 'enable_lb' => true },
:vhost_extra_params => {
'add_listen' => true ,
'setenvif' => ['X-Forwarded-Proto https HTTPS=1']
},
:openstack_endpoint_type => 'internalURL',
:allowed_hosts => ['horizon.openstack.org', 'vip.openstack.org']
)
end
end
end
context 'on Debian platforms' do