dashboard: improve horizon configuration

- Add keystone url
- configure memcache server
- swift and debug support

Close #119

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-01-29 22:48:13 +01:00
parent 8d9eba03da
commit 213af59886
2 changed files with 50 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,22 +64,37 @@ 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
) {
# ensure memcached is running on horizon node, since horizon supports only
# one memcached server
include 'cloud::cache'
$supported = [ 'RedHat', 'Debian' ]
if grep($supported, $::osfamily) != [$::osfamily] {
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,
cache_server_ip => $api_eth,
swift => true,
keystone_url => $keystone_url,
django_debug => $debug
}
@@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,13 @@ 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',
:cache_server_ip => '10.0.0.1',
:swift => true,
:keystone_url => 'http://keystone.openstack.org:5000/v2.0',
:django_debug => true
)
end
end
@@ -46,6 +54,8 @@ describe 'cloud::dashboard' do
{ :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '12.04',
:memorysize => '1000 MB',
:processorcount => '1',
:concat_basedir => '/var/lib/puppet/concat' }
end
@@ -56,23 +66,12 @@ describe 'cloud::dashboard' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystemrelease => '6',
:memorysize => '1000 MB',
: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