From 4108aea879b0b3a4926c73942c80110753cbbca8 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 7 Feb 2024 12:30:09 +0100 Subject: [PATCH] Fix horizon deployment New horizon release use [1] for cache backend instead of [2] as it was in previous versions. This patch: 1. Removes override from config and configure only memcached endpoints, not backend specification itself. This will avoid bugs in future in case BACKEND will be switched again. 2. Remove 'memcached' context from kolla_address filter and use 'url' as [1] don't support inet6:[{address}] for ipv6 but supports [{address}] which 'url' provides. [1] django.core.cache.backends.memcached.PyMemcacheCache [2] django.core.cache.backends.memcached.MemcachedCache Change-Id: Ie3a8f47e7b776b6aa2bb9b1522fdd4514ea1484b --- .../horizon/templates/_9998-kolla-settings.py.j2 | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ansible/roles/horizon/templates/_9998-kolla-settings.py.j2 b/ansible/roles/horizon/templates/_9998-kolla-settings.py.j2 index 09119a8de1..66c786a730 100644 --- a/ansible/roles/horizon/templates/_9998-kolla-settings.py.j2 +++ b/ansible/roles/horizon/templates/_9998-kolla-settings.py.j2 @@ -16,6 +16,9 @@ DATABASES = { 'PORT': '{{ database_port }}' } } +{% elif groups['memcached'] | length > 0 and not horizon_backend_database | bool %} +SESSION_ENGINE = 'django.contrib.sessions.backends.cache' +CACHES['default']['LOCATION'] = [{% for host in groups['memcached'] %}'{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ memcached_port }}'{% if not loop.last %},{% endif %}{% endfor %}] {% endif %} {% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %} @@ -39,16 +42,6 @@ OPENSTACK_KEYSTONE_DOMAIN_CHOICES = ( LOCAL_PATH = '/tmp' SECRET_KEY='{{ horizon_secret_key }}' -{% if groups['memcached'] | length > 0 and horizon_backend_database | bool == False %} -SESSION_ENGINE = 'django.contrib.sessions.backends.cache' -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache', - 'LOCATION': [{% for host in groups['memcached'] %}'{{ 'api' | kolla_address(host) | put_address_in_context('memcache') }}:{{ memcached_port }}'{% if not loop.last %},{% endif %}{% endfor %}] - } -} -{% endif %} - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' {% if multiple_regions_names|length > 1 %}