From ddec1b88666724074d1ea0460a7bf504c60fb7e8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 3 Aug 2024 21:17:21 +0900 Subject: [PATCH] Support COMPRESS_ROOT option Change-Id: I037f1ecd857981b5dc6b4162007480484c48f681 --- manifests/init.pp | 6 ++++++ releasenotes/notes/compress_root-0a77ff2912d85a57.yaml | 4 ++++ spec/classes/horizon_init_spec.rb | 2 ++ templates/local_settings.py.erb | 7 +++++++ 4 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/compress_root-0a77ff2912d85a57.yaml diff --git a/manifests/init.pp b/manifests/init.pp index dfcc1363..a1319b16 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -183,6 +183,11 @@ # (optional) Boolean to enable offline compress of assets. # Defaults to True # +# [*compress_root*] +# (optional) Absolute file path that linked static will be read from and +# compressed static will be written to +# Defaults to undef +# # [*hypervisor_options*] # (optional) A hash of parameters to enable features specific to # Hypervisors. @@ -606,6 +611,7 @@ class horizon( $wsgi_threads = '1', Boolean $compress_enabled = true, Boolean $compress_offline = true, + Optional[Stdlib::Absolutepath] $compress_root = undef, # TODO(tkajinam) Consider adding more strict validation about key-value Hash $hypervisor_options = {}, Hash $cinder_options = {}, diff --git a/releasenotes/notes/compress_root-0a77ff2912d85a57.yaml b/releasenotes/notes/compress_root-0a77ff2912d85a57.yaml new file mode 100644 index 00000000..56837bf8 --- /dev/null +++ b/releasenotes/notes/compress_root-0a77ff2912d85a57.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``horizon::compress_root`` parameter has been added. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 2ca88857..5d7e6165 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -114,6 +114,7 @@ describe 'horizon' do :dropdown_max_items => 123, :compress_enabled => false, :compress_offline => false, + :compress_root => '/tmp', :hypervisor_options => {'can_set_mount_point' => false, 'can_set_password' => true }, :cinder_options => {'enable_backup' => true }, :keystone_options => {'name' => 'native', 'can_edit_user' => true, 'can_edit_group' => true, 'can_edit_project' => true, 'can_edit_domain' => false, 'can_edit_role' => false}, @@ -223,6 +224,7 @@ describe 'horizon' do 'TOKEN_TIMEOUT_MARGIN = 60', 'COMPRESS_ENABLED = False', 'COMPRESS_OFFLINE = False', + "COMPRESS_ROOT = '/tmp'", "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'", 'OVERVIEW_DAYS_RANGE = 1', 'DISALLOW_IFRAME_EMBED = True', diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index fa914bf4..9d47b56f 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -1066,6 +1066,13 @@ COMPRESS_ENABLED = <%= @compress_enabled.to_s.capitalize %> # the python-lesscpy package and disable the following option. COMPRESS_OFFLINE = <%= @compress_offline.to_s.capitalize %> +# Controls the absolute file path that linked static will be read from and +# compressed static will be written to +# COMPRESS_ROOT = STATIC_ROOT +<% if ! @compress_root.nil? -%> +COMPRESS_ROOT = '<%= @compress_root %>' +<% end -%> + # For Glance image upload, Horizon uses the file upload support from Django # so we add this option to change the directory where uploaded files are temporarily # stored until they are loaded into Glance.