Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom config is not applied #302

Open
xek opened this issue Mar 20, 2024 · 5 comments
Open

Custom config is not applied #302

xek opened this issue Mar 20, 2024 · 5 comments

Comments

@xek
Copy link

xek commented Mar 20, 2024

I tried to apply the following config:

oc get cm horizon-config-data -o jsonpath={.data} | jq '."9999_custom_settings.py"'
"SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'\nCACHES = {\n  \"default\": {\n    \"BACKEND\": \"django.core.cache.backends.filebased.FileBasedCache\",\n    \"LOCATION\": \"/var/tmp/django_cache\",\n  }\n}\n"

The service still fails connecting to memcached, since I have TLS enabled. On furthter inspection, I see that the settings are not applied:

[root@horizon-696978b96-2vqpw /]# ./usr/share/openstack-dashboard/manage.py shell
Python 3.9.18 (main, Jan 24 2024, 00:00:00) 
[GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import settings
WARNING:root:"dashboards" and "default_dashboard" in (local_)settings is DEPRECATED now and may be unsupported in some future release. The preferred way to specify the order of dashboards and the default dashboard is the pluggable dashboard mechanism (in /usr/share/openstack-dashboard/openstack_dashboard/enabled, /usr/share/openstack-dashboard/openstack_dashboard/local/enabled).
>>> settings.SESSION_ENGINE
'django.contrib.sessions.backends.cache'
>>> 

I think there needs to be an import in local_settings.py to import all of the files from the /etc/openstack-dashboard/local_settings.d/ directory.

@deshipu
Copy link
Contributor

deshipu commented Mar 21, 2024

It already loads all files from /usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.d:

https://github.com/openstack/horizon/blob/master/openstack_dashboard/settings.py#L268-L280

@xek
Copy link
Author

xek commented Mar 21, 2024

Oh, I haven't seen that. Maybe the issue is that the local_settings.py, which is also placed in this directory, overwrites the contents of 9999_custom_settings.py? I guess it should be renamed to 0000_local_settings.py

"dest": "/etc/openstack-dashboard/local_settings",

I'll take a second look once I have it deployed again.

@deshipu
Copy link
Contributor

deshipu commented Mar 21, 2024

No, local_settings.py is loaded before local_settings.d, and renaming it will just result in it not being found at all.

The problem is that you are putting things in /etc/openstack-dashboard/local_settings.d but the application doesn't know about it and checks its own directories at /usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.d.

TripleO didn't like that and moved some (but not all) of the configuration files to /etc, replacing them with symlinks.

The horizon-operator assumed those files should be in /etc just like TripleO did, but doesn't create the symlinks (only the symlink for /etc/openstack-dashboard/local_settings is created). So nothing works.

@deshipu
Copy link
Contributor

deshipu commented Mar 21, 2024

Be the way, we can (and should) just put the memcached config in the local_settings directly, that's how we did it originally with puppet-horizon.

@deshipu
Copy link
Contributor

deshipu commented Apr 10, 2024

Those symlinks are also required for the plugins and the downstream theme to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants