Merge pull request #121 from enovance/bug/119/emilien

dashboard: improve horizon configuration
This commit is contained in:
Yanis Guenane 2014-01-31 08:09:31 -08:00
commit 2fdb927b64
2 changed files with 52 additions and 20 deletions

View File

@ -41,6 +41,22 @@
# It requires SSL files (keys and certificates)
# Defaults false
#
# [*keystone_proto*]
# (optional) Protocol (http or https) of keystone endpoint.
#  Defaults to params.
#
# [*keystone_host*]
# (optional) IP / Host of keystone endpoint.
#  Defaults to params.
#
# [*keystone_port*]
# (optional) TCP port of keystone endpoint.
#  Defaults to params.
#
# [*debug*]
# (optional) Enable debug or not.
#  Defaults to params.
#
class cloud::dashboard(
$ks_keystone_internal_host = $os_params::ks_keystone_internal_host,
@ -48,6 +64,10 @@ class cloud::dashboard(
$horizon_port = $os_params::horizon_port,
$api_eth = $os_params::api_eth,
$listen_ssl = false,
$keystone_host = $os_params::ks_keystone_internal_host,
$keystone_proto = $os_params::ks_keystone_internal_proto,
$keystone_port = $os_params::ks_keystone_internal_port,
$debug = $os_params::debug
) {
$supported = [ 'RedHat', 'Debian' ]
@ -55,15 +75,31 @@ class cloud::dashboard(
fail("module puppet-horizon doesn't support ${::osfamily}")
}
# We build the param needed for horizon class
$keystone_url = "${keystone_proto}://${keystone_host}:${keystone_port}/v2.0"
class {'horizon':
secret_key => $secret_key,
keystone_host => $ks_keystone_internal_host,
can_set_mount_point => 'False',
# fqdn can can be ambiguous since we use reverse DNS here,
# e.g: 127.0.0.1 instead of a public IP address.
# We force $api_eth to avoid this situation
# fqdn can can be ambiguous since we use reverse DNS here,
# e.g: 127.0.0.1 instead of a public IP address.
# We force $api_eth to avoid this situation
fqdn => $api_eth,
bind_address => $api_eth
bind_address => $api_eth,
swift => true,
keystone_url => $keystone_url,
django_debug => $debug
}
if ($::osfamily == 'Debian') {
# TODO(Gonéri): HACK to ensure Horizon can cache its files
$horizon_var_dir = [ "/var/lib/openstack-dashboard/static/js", "/var/lib/openstack-dashboard/static/css" ]
file {$horizon_var_dir:
owner => 'horizon',
group => 'horizon',
ensure => directory,
}
}
@@haproxy::balancermember{"${::fqdn}-horizon":

View File

@ -27,6 +27,10 @@ describe 'cloud::dashboard' do
:ks_keystone_internal_host => 'localhost',
:ks_keystone_internal_host => 'localhost',
:secret_key => '/etc/ssl/secret',
:keystone_host => 'keystone.openstack.org',
:keystone_proto => 'http',
:keystone_port => '5000',
:debug => true,
:api_eth => '10.0.0.1' }
end
@ -34,9 +38,12 @@ describe 'cloud::dashboard' do
should contain_class('horizon').with(
:listen_ssl => false,
:secret_key => '/etc/ssl/secret',
:keystone_host => 'localhost',
:can_set_mount_point => 'False',
:fqdn => '10.0.0.1'
:fqdn => '10.0.0.1',
:bind_address => '10.0.0.1',
:swift => true,
:keystone_url => 'http://keystone.openstack.org:5000/v2.0',
:django_debug => true
)
end
end
@ -46,6 +53,7 @@ describe 'cloud::dashboard' do
{ :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
:processorcount => '1',
:concat_basedir => '/var/lib/puppet/concat' }
end
@ -56,23 +64,11 @@ describe 'cloud::dashboard' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemrelease => '6',
:processorcount => '1',
:concat_basedir => '/var/lib/puppet/concat' }
end
it_configures 'openstack dashboard'
end
context 'on other platforms' do
let :facts do
{ :osfamily => 'Solaris',
:operatingsystemrelease => '10',
:concat_basedir => '/var/lib/puppet/concat' }
end
it 'should fail' do
expect { subject }.to raise_error(/module puppet-horizon doesn't support/)
end
end
end