Fix missing HORIZON_IMAGES_UPLOAD_MODE

The value as of current is treated as an expression
by horizon and will cause horizon to fail. The value
must be encapsulated with quotes so it is treated as
a string.

Closes-Bug: #1946277
Change-Id: I7a900d75ddffae88760d5965a1f9ac2f4277624f
This commit is contained in:
Matthew J. Black 2021-10-06 04:06:57 -05:00 committed by Takashi Kajinami
parent a1657e083d
commit 625275af36
4 changed files with 32 additions and 3 deletions

View File

@ -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.')
}

View File

@ -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.

View File

@ -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

View File

@ -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 %>