Remove support for MemcachedCache backend

MemcachedCache backend was removed in django 4.1[1]. The latest horizon
requires django>=4.2[2] so we are no longer able to use the backend.

[1] 05f3a6186e
[2] 605a515ebc31beb66ff46cb193bc96c62d086ff6

Change-Id: Ia8c3f11aa33d4a48577be83c3372229818789543
This commit is contained in:
Takashi Kajinami 2024-12-13 12:23:09 +09:00
parent ce86df8101
commit 4ffebe8483
4 changed files with 10 additions and 64 deletions

View File

@ -689,11 +689,7 @@ class horizon(
}
if $cache_server_ip {
if $cache_backend =~ /\.MemcachedCache$/ {
$cache_server_ip_real = inet6_prefix($cache_server_ip)
} else {
$cache_server_ip_real = normalize_ip_for_uri($cache_server_ip)
}
$cache_server_ip_real = normalize_ip_for_uri($cache_server_ip)
}
if $websso_choices_hide_keystone and !$websso_initial_choice {
@ -714,16 +710,7 @@ class horizon(
if $manage_memcache_package {
if $cache_backend =~ /\.MemcachedCache$/ {
warning("Support for MemcachedCache backend has been deprecated. \
Use PyMemcacheCache backend instead")
ensure_packages('python-memcache', {
name => $::horizon::params::memcache_package,
tag => ['openstack'],
})
Anchor['horizon::install::begin']
-> Package<| name == $::horizon::params::memcache_package |>
-> Anchor['horizon::install::end']
fail('MemcachedCache backend is no longer supported')
} elsif $cache_backend =~ /\.PyMemcacheCache$/ {
ensure_packages('python-pymemcache', {
name => $::horizon::params::pymemcache_package,

View File

@ -21,7 +21,6 @@ class horizon::params {
$django_wsgi = '/usr/share/openstack-dashboard/openstack_dashboard/wsgi.py'
$wsgi_user = 'apache'
$wsgi_group = 'apache'
$memcache_package = 'python3-memcached'
$pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'openstack-designate-ui'
@ -40,7 +39,6 @@ class horizon::params {
$static_path = '/var/lib'
$wsgi_user = 'horizon'
$wsgi_group = 'horizon'
$memcache_package = 'python3-memcache'
$pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'python3-designate-dashboard'

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
Support for MemcachedCache backend has been removed. The backend was
removed in django 4.1, and can no longer be used because now horizon
requires django 4.2 or later.

View File

@ -95,7 +95,7 @@ describe 'horizon' do
params.merge!({
:purge_conf_d_dir => true,
:memoized_max_size_default => 25,
:cache_backend => 'django.core.cache.backends.memcached.MemcachedCache',
:cache_backend => 'django.core.cache.backends.memcached.PyMemcacheCache',
:cache_timeout => 300,
:cache_options => {'SOCKET_TIMEOUT' => 1,'SERVER_RETRIES' => 1,'DEAD_RETRY' => 1},
:cache_server_ip => '10.0.0.1',
@ -176,7 +176,7 @@ describe 'horizon' do
" 'SERVER_RETRIES': 1,",
" 'SOCKET_TIMEOUT': 1,",
"MEMOIZED_MAX_SIZE_DEFAULT = 25",
" 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',",
" 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',",
" 'LOCATION': '10.0.0.1:11211',",
" 'TIMEOUT': 300,",
'SESSION_ENGINE = "django.contrib.sessions.backends.cache"',
@ -269,22 +269,6 @@ describe 'horizon' do
end
end
context 'with overridden parameters, IPv6 cache_server_ip array and MemcachedCache' do
before do
params.merge!({
:cache_backend => 'django.core.cache.backends.memcached.MemcachedCache',
: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', [
" 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',",
" 'LOCATION': [ 'inet6:[fd12:3456:789a:1::1]:11211','inet6:[fd12:3456:789a:1::2]:11211', ],",
])
end
end
context 'with overridden parameters, IPv6 cache_server_ip array and PyMemcacheCache' do
before do
params.merge!({
@ -329,32 +313,6 @@ describe 'horizon' do
end
end
context 'installs python memcache library when cache_backend is set to memcache' do
before do
params.merge!({
:cache_backend => 'django.core.cache.backends.memcached.MemcachedCache'
})
end
it {
is_expected.to contain_package('python-memcache').with(
:tag => ['openstack'],
:name => platforms_params[:memcache_package],
)
}
end
context 'does not install python memcache when manage_memcache_package set to false' do
before do
params.merge!({
:cache_backend => 'django.core.cache.backends.memcached.MemcachedCache',
:manage_memcache_package => false
})
end
it { is_expected.not_to contain_package('python-memcache') }
end
context 'installs python memcache library when cache_backend is set to pymemcache' do
before do
params.merge!({
@ -863,7 +821,6 @@ describe 'horizon' do
:package_name => 'openstack-dashboard-apache',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon',
@ -876,7 +833,6 @@ describe 'horizon' do
:package_name => 'openstack-dashboard',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon',
@ -890,7 +846,6 @@ describe 'horizon' do
:package_name => 'openstack-dashboard',
:root_url => '/dashboard',
:root_path => '/usr/share/openstack-dashboard',
:memcache_package => 'python3-memcached',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'apache',