From a0bfa42751c35358f135e791f90af97e6d92cf32 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 31 Aug 2022 01:07:53 +0900 Subject: [PATCH] Horizon: Switch to PyMemcacheCache backend MemcachedCache was deprecated in django 3.2[1], and was later removed in django 4.1[2]. Because python3-pymemcache package in Ubuntu is too old (2.2.0) and is not compatible with Django(which requires >=3.4.0), Ubuntu jobs still use the deprecated python-memcached backend. [1] https://github.com/django/django/commit/5ce31d6a7142ca8c76d6b52fa42b3406b9a8ff48 [2] https://github.com/django/django/commit/05f3a6186efefc9fca2204a745b992501c6fd91f Depends-on: https://review.opendev.org/855298 Change-Id: I10d99c972741b82308b1d4eeddd8cb65f237d6f7 --- manifests/horizon.pp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/manifests/horizon.pp b/manifests/horizon.pp index 391ca4ccc..7d29c46ff 100644 --- a/manifests/horizon.pp +++ b/manifests/horizon.pp @@ -41,9 +41,17 @@ class openstack_integration::horizon ( Exec['update-ca-certificates'] ~> Service['httpd'] } + # TODO(tkajinam): Switch to pymemcache backend when we bump Ubuntu from + # Focal to Jammy. The pymemcache package in Forcal is too old + # and is not compatible with Django. + $cache_backend = $::osfamily ? { + 'Debian' => 'django.core.cache.backends.memcached.MemcachedCache', + default => 'django.core.cache.backends.memcached.PyMemcacheCache' + } + class { 'horizon': secret_key => 'big_secret', - cache_backend => 'django.core.cache.backends.memcached.MemcachedCache', + cache_backend => $cache_backend, cache_server_ip => $::openstack_integration::config::host, allowed_hosts => $::openstack_integration::config::ip_for_url, listen_ssl => $::openstack_integration::config::ssl,