Rework horizon image to support local_settings.d

The local_settings.py config is rendered by kolla-ansible
orchestration, which is not a good approach because upstream
local_settings.py can be changed anytime and that can be a problem,
as it was shown recently with the new version of horizon.

Fortunately, horizon supports local_settings overrides in
local_settings.d directory and moreover it's preffered
way how to configure horizon as per doc [1].

This patch just change the structure of files to support it.

[1] https://docs.openstack.org/horizon/latest/configuration/settings.html

Change-Id: Ib0c060adffe5287d786ba9247c6b962732cdb5e0
This commit is contained in:
Michal Arbet 2024-01-23 06:14:41 +01:00
parent 76d78b50c0
commit fde9264e66
1 changed files with 11 additions and 1 deletions

View File

@ -46,12 +46,22 @@ ADD plugins-archive /
COPY extend_start.sh /usr/local/bin/kolla_extend_start
# NOTE(hrw): to install horizon from unpacked sources we cannot have it in upper-constraints.txt
# NOTE(kevko): This dance with local settings python paths below is needed
# because we are using different distros with different python version and we need to
# know to which path symlink should point to.
RUN ln -s horizon-source/* horizon \
&& {{ macros.upper_constraints_remove("horizon") }} \
&& {{ macros.install_pip(horizon_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/openstack-dashboard \
&& cp -r /horizon/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
&& cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings \
&& cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings.py \
&& local_settings=$(python -c 'import os;import openstack_dashboard;settings=os.path.dirname(openstack_dashboard.__file__) + "/local/local_settings.py";print(settings);') \
&& rm -f $local_settings \
&& ln -s /etc/openstack-dashboard/local_settings.py $local_settings \
&& mkdir -p /etc/openstack-dashboard/local_settings.d \
&& local_settings_d=$(python -c 'import os;import openstack_dashboard;settings_d=os.path.dirname(openstack_dashboard.__file__) + "/local/local_settings.d";print(settings_d);') \
&& rm -rf $local_settings_d \
&& ln -s /etc/openstack-dashboard/local_settings.d $local_settings_d \
&& cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \
&& if [ "$(ls /plugins)" ]; then \
{{ macros.install_pip(horizon_plugins_pip_packages) }}; \