From 03d3469f718c00bf4bc50eb126298597e8a6f2b5 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 6 Sep 2021 11:55:41 +0900 Subject: [PATCH] Fix how disallow_iframe_embed is defined The disallow_iframe_embed option doesn't belong to HORIZON_CONFIG but should be described as a variable in local_settings. Closes-Bug: #1942722 Change-Id: I189fbb0a76ba63e16f6c3b6ad9db6f9e0355617f (cherry picked from commit 7153d5cdfac9288bca22caedb064ea5aa903c2eb) (cherry picked from commit 7135e8d99d6e11522006291c224e88a87a4e942b) --- releasenotes/notes/bug-1942722-3cc45ac696688336.yaml | 4 ++++ spec/classes/horizon_init_spec.rb | 7 ++++--- templates/local_settings.py.erb | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/bug-1942722-3cc45ac696688336.yaml diff --git a/releasenotes/notes/bug-1942722-3cc45ac696688336.yaml b/releasenotes/notes/bug-1942722-3cc45ac696688336.yaml new file mode 100644 index 00000000..0bddff6b --- /dev/null +++ b/releasenotes/notes/bug-1942722-3cc45ac696688336.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed wrong usage of the ``DISALLOW_IFRAME_EMBED`` option. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 732e1c6a..13b8f831 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -217,6 +217,7 @@ describe 'horizon' do 'COMPRESS_OFFLINE = False', "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'", "OVERVIEW_DAYS_RANGE = 1", + 'DISALLOW_IFRAME_EMBED = True', ]) end @@ -581,16 +582,16 @@ describe 'horizon' do end end - context 'with disallow iframe embed enabled' do + context 'with disallow iframe embed disabled' do before do params.merge!({ - :disallow_iframe_embed => true + :disallow_iframe_embed => false }) end it 'disallow_iframe_embed is configured' do verify_concat_fragment_contents(catalogue, 'local_settings.py', [ - 'HORIZON_CONFIG["disallow_iframe_embed"] = True', + 'DISALLOW_IFRAME_EMBED = False', ]) end end diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 4b71c93b..fada979a 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -1004,9 +1004,7 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES', # For more information see: # http://tinyurl.com/anticlickjack #DISALLOW_IFRAME_EMBED = True -<% if @disallow_iframe_embed == true %> -HORIZON_CONFIG["disallow_iframe_embed"] = True -<% end %> +DISALLOW_IFRAME_EMBED = <%= @disallow_iframe_embed.to_s.capitalize %> <% if @horizon_upload_mode %> HORIZON_IMAGES_UPLOAD_MODE = <%= @horizon_upload_mode %>