Accept array for cache_server_url

... so that we can specify multiple backend servers.

Conflicts:
	templates/local_settings.py.erb

Change-Id: Iea01d1c5202890110c33341cedee4b5bc1ba324c
(cherry picked from commit 8b268d75ce)
(cherry picked from commit 53ca170aba)
This commit is contained in:
Takashi Kajinami 2022-07-31 00:08:36 +09:00
parent f19fc003ec
commit 68ad93ef7b
2 changed files with 22 additions and 1 deletions

View File

@ -251,7 +251,7 @@ describe 'horizon' do
it { is_expected.to contain_exec('refresh_horizon_django_compress') }
end
context 'with overridden parameters and cache_server_url' do
context 'with overridden parameters and cache_server_url (string)' do
before do
params.merge!({
:cache_server_url => 'redis://:password@10.0.0.1:6379/1',
@ -268,6 +268,23 @@ describe 'horizon' do
it { is_expected.to contain_exec('refresh_horizon_django_compress') }
end
context 'with overridden parameters and cache_server_url (array)' do
before do
params.merge!({
:cache_server_url => ['192.0.2.1:11211', '192.0.2.2:11211'],
})
end
it 'generates local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
" 'LOCATION': ['192.0.2.1:11211','192.0.2.2:11211'],",
])
end
it { is_expected.to contain_exec('refresh_horizon_django_cache') }
it { is_expected.to contain_exec('refresh_horizon_django_compress') }
end
context 'installs python memcache library when cache_backend is set to memcache' do
before do
params.merge!({

View File

@ -241,7 +241,11 @@ CACHES = {
<% end %>
<% end %>
<% if @cache_server_url %>
<%- if @cache_server_url.kind_of?(Array) -%>
'LOCATION': ['<%= @cache_server_url.join("','") %>'],
<%- else -%>
'LOCATION': '<%= @cache_server_url %>',
<%- end -%>
<% end %>
}
}