Prefix memcached_servers IPv6 address with `inet6:`

New dependency: openstack/openstacklib

Depends-On: https://review.opendev.org/661136
Change-Id: I3e1d2108403ece5866a0df0afd367fb80145a0df
This commit is contained in:
Harald Jensås 2019-05-24 09:20:08 +02:00
parent 31c74144c6
commit cd38dca375
4 changed files with 28 additions and 3 deletions

View File

@ -546,6 +546,10 @@ class horizon(
fail('Only one of cache_server_url or cache_server_ip can be set.')
}
if $cache_server_ip {
$cache_server_ip_real = inet6_prefix($cache_server_ip)
}
$hypervisor_defaults = {
'can_set_mount_point' => true,
'can_set_password' => false,

View File

@ -12,6 +12,10 @@
{
"name": "saz/memcached",
"version_requirement": ">=2.0.2 <3.0.0"
},
{
"name": "openstack/openstacklib",
"version_requirement": ">=15.0.0 <16.0.0"
}
],
"description": "Installs and configures OpenStack Horizon (Dashboard).",

View File

@ -249,6 +249,23 @@ describe 'horizon' do
it { is_expected.to contain_exec('refresh_horizon_django_compress') }
end
context 'with overridden parameters and IPv6 cache_server_ip array' do
before do
params.merge!({
:cache_server_ip => ['fd12:3456:789a:1::1','fd12:3456:789a:1::2'],
})
end
it 'generates local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
" 'LOCATION': [ 'inet6:[fd12:3456:789a:1::1]:11211','inet6:[fd12:3456:789a:1::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 'with overridden parameters and cache_server_url' do
before do
params.merge!({

View File

@ -226,11 +226,11 @@ CACHES = {
<% end -%>
'BACKEND': '<%= @cache_backend %>',
<% if @cache_server_ip %>
<% if @cache_server_ip.kind_of?(Array) %>
<% if @cache_server_ip_real.kind_of?(Array) %>
<% split = ":" + @cache_server_port + "','" %>
'LOCATION': [ <% @cache_server_ip.each do |ip| -%>'<%= ip -%>:<%= @cache_server_port -%>',<% end -%> ],
'LOCATION': [ <% @cache_server_ip_real.each do |ip| -%>'<%= ip -%>:<%= @cache_server_port -%>',<% end -%> ],
<% else %>
'LOCATION': '<%= @cache_server_ip %>:<%= @cache_server_port %>',
'LOCATION': '<%= @cache_server_ip_real %>:<%= @cache_server_port %>',
<% end %>
<% end %>
<% if @cache_server_url %>