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
This commit is contained in:
Michal Arbet 2024-02-07 12:30:09 +01:00
parent b5aa63dee1
commit 4108aea879

View File

@ -16,6 +16,9 @@ DATABASES = {
'PORT': '{{ database_port }}' '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 %} {% endif %}
{% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %} {% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %}
@ -39,16 +42,6 @@ OPENSTACK_KEYSTONE_DOMAIN_CHOICES = (
LOCAL_PATH = '/tmp' LOCAL_PATH = '/tmp'
SECRET_KEY='{{ horizon_secret_key }}' 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' EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
{% if multiple_regions_names|length > 1 %} {% if multiple_regions_names|length > 1 %}