Add more parameters:

* secret key
* django_debug
* api_result_limit
This commit is contained in:
François Charlier 2012-06-28 16:21:30 +02:00
parent fa9c64a68c
commit 80f94729b6
3 changed files with 24 additions and 7 deletions

View File

@ -3,9 +3,7 @@
#
#
# - Parameters
# $keystone_host ip address/hostname of the keystone service
# $keystone_port public port of the keystone service
# $keystone_scheme http or https
# $secret_key the application secret key (used to crypt cookies, etc. ). mandatory
# $cache_server_ip memcached ip address (or VIP)
# $cache_server_port memcached port
# $swift (bool) is swift installed
@ -14,8 +12,15 @@
# There is no specific requirement for these apps to be for monitoring, that's just the defacto purpose.
# Each app is defined in two parts, the display name, and the URI
# [horizon_app_links] array as in '[ ["Nagios","http://nagios_addr:port/path"],["Ganglia","http://ganglia_addr"] ]'
# $keystone_host ip address/hostname of the keystone service
# $keystone_port public port of the keystone service
# $keystone_scheme http or https
# $keystone_default_role default keystone role for new users
# $django_debug True/False. enable/disables debugging. defaults to false
# $api_result_limit max number of Swift containers/objects to display on a single page
#
class horizon(
$secret_key,
$cache_server_ip = '127.0.0.1',
$cache_server_port = '11211',
$swift = false,
@ -25,6 +30,8 @@ class horizon(
$keystone_port = 5000,
$keystone_scheme = 'http',
$keystone_default_role = 'Member',
$django_debug = 'False',
$api_result_limit = 1000,
) {
include horizon::params

View File

@ -3,7 +3,8 @@ require 'spec_helper'
describe 'horizon' do
let :params do
{
'cache_server_ip' => '10.0.0.1'
'cache_server_ip' => '10.0.0.1',
'secret_key' => 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'
}
end
@ -31,25 +32,34 @@ describe 'horizon' do
}
describe 'with default parameters' do
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_HOST = "127.0.0.1"$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_KEYSTONE_URL = "http:\/\/%s:5000\/v2.0" % OPENSTACK_HOST$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^DEBUG = False$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^API_RESULT_LIMIT = 1000$/) }
end
describe 'when overriding parameters' do
let :params do
{
:secret_key => 'dummy',
:cache_server_ip => '10.0.0.1',
:keystone_host => 'keystone.example.com',
:keystone_port => 4682,
:keystone_scheme => 'https',
:keystone_default_role => 'SwiftOperator',
:django_debug => 'True',
:api_result_limit => 4682,
}
end
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^SECRET_KEY = 'dummy'$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_HOST = "keystone.example.com"$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_KEYSTONE_URL = "https:\/\/%s:4682\/v2.0" % OPENSTACK_HOST$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^OPENSTACK_KEYSTONE_DEFAULT_ROLE = "SwiftOperator"$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^DEBUG = True$/) }
it { should contain_file('/etc/openstack-dashboard/local_settings.py').with_content(/^API_RESULT_LIMIT = 4682$/) }
end
end
end

View File

@ -2,13 +2,13 @@ import os
from django.utils.translation import ugettext_lazy as _
DEBUG = True
DEBUG = <%= django_debug %>
TEMPLATE_DEBUG = DEBUG
PROD = False
USE_SSL = False
# Note: You should change this value
SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'
SECRET_KEY = '<%= secret_key %>'
# Specify a regular expression to validate user passwords.
# HORIZON_CONFIG = {
@ -69,7 +69,7 @@ SWIFT_ENABLED = True
# The number of Swift containers and objects to display on a single page before
# providing a paging element (a "more" link) to paginate results.
API_RESULT_LIMIT = 1000
API_RESULT_LIMIT = <%= api_result_limit %>
<% if quantum -%>
# Include the Quantum interface extensions in Horizon