diff --git a/deployment/puppet/horizon/manifests/init.pp b/deployment/puppet/horizon/manifests/init.pp index d3f809390d..fc18df07d5 100644 --- a/deployment/puppet/horizon/manifests/init.pp +++ b/deployment/puppet/horizon/manifests/init.pp @@ -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 diff --git a/deployment/puppet/horizon/spec/classes/horizon_init_spec.rb b/deployment/puppet/horizon/spec/classes/horizon_init_spec.rb index 610f2bcc38..4c38087d6e 100644 --- a/deployment/puppet/horizon/spec/classes/horizon_init_spec.rb +++ b/deployment/puppet/horizon/spec/classes/horizon_init_spec.rb @@ -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 diff --git a/deployment/puppet/horizon/templates/local_settings.py.erb b/deployment/puppet/horizon/templates/local_settings.py.erb index f117c81b4a..43dff4098b 100644 --- a/deployment/puppet/horizon/templates/local_settings.py.erb +++ b/deployment/puppet/horizon/templates/local_settings.py.erb @@ -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