diff --git a/manifests/init.pp b/manifests/init.pp index b6941187..a3636891 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -632,6 +632,17 @@ class horizon( include horizon::dashboards::heat } + # TODO(tkajinam): Remove this logic after Yoga cycle. + if $horizon_upload_mode != undef { + $horizon_upload_mode_real = regsubst($horizon_upload_mode, "('|\")", '', 'G') + if $horizon_upload_mode != $horizon_upload_mode_real { + warning('The horizon_upload_mode parameter is now quoted automatically, \ +and usage of a quoted value is deprecated.') + } + } else { + $horizon_upload_mode_real = undef + } + if $cache_server_url and $cache_server_ip { fail('Only one of cache_server_url or cache_server_ip can be set.') } diff --git a/releasenotes/notes/fix_missing_quotes_for_images_upload-bcd649d0311afe32.yaml b/releasenotes/notes/fix_missing_quotes_for_images_upload-bcd649d0311afe32.yaml new file mode 100644 index 00000000..e82adc3f --- /dev/null +++ b/releasenotes/notes/fix_missing_quotes_for_images_upload-bcd649d0311afe32.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix HORIZON_IMAGES_UPLOAD_MODE in template file because the value must be + encapsulated with quotes or it will be treated as an expression by horizon. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 1c9c6de7..77bec752 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -694,7 +694,20 @@ describe 'horizon' do end it 'sets HORIZON_IMAGES_UPLOAD_MODE in local_settings.py' do verify_concat_fragment_contents(catalogue, 'local_settings.py', [ - 'HORIZON_IMAGES_UPLOAD_MODE = direct', + 'HORIZON_IMAGES_UPLOAD_MODE = "direct"', + ]) + end + end + + context 'with upload mode with quotes' do + before do + params.merge!({ + :horizon_upload_mode => '"direct"', + }) + end + it 'sets HORIZON_IMAGES_UPLOAD_MODE in local_settings.py' do + verify_concat_fragment_contents(catalogue, 'local_settings.py', [ + 'HORIZON_IMAGES_UPLOAD_MODE = "direct"', ]) end end diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 50b216e4..037abf9e 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -1038,6 +1038,6 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES', #DISALLOW_IFRAME_EMBED = True DISALLOW_IFRAME_EMBED = <%= @disallow_iframe_embed.to_s.capitalize %> -<% if @horizon_upload_mode %> -HORIZON_IMAGES_UPLOAD_MODE = <%= @horizon_upload_mode %> +<% if @horizon_upload_mode_real %> +HORIZON_IMAGES_UPLOAD_MODE = "<%= @horizon_upload_mode_real %>" <% end %>