diff --git a/manifests/init.pp b/manifests/init.pp index c81e9ea4..026ddf2b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -82,6 +82,10 @@ # [*help_url*] # (optional) Location where the documentation should point. # Defaults to 'http://docs.openstack.org'. +# +# [*compress_offline*] +# (optional) Boolean to enable offline compress of assets. +# Defaults to True class horizon( $secret_key, @@ -108,7 +112,8 @@ class horizon( $horizon_key = undef, $horizon_ca = undef, $help_url = 'http://docs.openstack.org', - $local_settings_template = 'horizon/local_settings.py.erb' + $local_settings_template = 'horizon/local_settings.py.erb', + $compress_offline = 'True' ) { include horizon::params diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 725802fa..990a4fd5 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -83,7 +83,8 @@ describe 'horizon' do 'API_RESULT_LIMIT = 1000', "LOGIN_URL = '/horizon/auth/login/'", "LOGOUT_URL = '/horizon/auth/logout/'", - "LOGIN_REDIRECT_URL = '/horizon'" + "LOGIN_REDIRECT_URL = '/horizon'", + 'COMPRESS_OFFLINE = True' ]) end end @@ -100,6 +101,7 @@ describe 'horizon' do :django_debug => true, :api_result_limit => 4682, :can_set_mount_point => false, + :compress_offline => 'False', }) end @@ -112,7 +114,8 @@ describe 'horizon' do 'OPENSTACK_KEYSTONE_URL = "https://%s:4682/v2.0" % OPENSTACK_HOST', 'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "SwiftOperator"', " 'can_set_mount_point': False,", - 'API_RESULT_LIMIT = 4682' + 'API_RESULT_LIMIT = 4682', + 'COMPRESS_OFFLINE = False' ]) end end diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index a2515a6e..fec7a0ff 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -526,3 +526,8 @@ SECURITY_GROUP_RULES = { LOGIN_URL = '<%= scope.lookupvar("horizon::params::root_url") %>/auth/login/' LOGOUT_URL = '<%= scope.lookupvar("horizon::params::root_url") %>/auth/logout/' LOGIN_REDIRECT_URL = '<%= scope.lookupvar("horizon::params::root_url") %>' + +# The Ubuntu package includes pre-compressed JS and compiled CSS to allow +# offline compression by default. To enable online compression, install +# the python-lesscpy package and disable the following option. +COMPRESS_OFFLINE = <%= @compress_offline.to_s.capitalize %>