diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2026-07-06 15:26:00 +0200 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2026-07-06 19:59:40 +0000 |
| commit | db35ac8d793506bc43b62e7e39d27a75de1043ed (patch) | |
| tree | feec28d13a43490f5fd4260374144a1abfc20331 /docker/horizon | |
| parent | 1ae1850557e3b99902f73b32c9005618537a1f2d (diff) | |
| download | kolla-db35ac8d793506bc43b62e7e39d27a75de1043ed.tar.gz kolla-db35ac8d793506bc43b62e7e39d27a75de1043ed.zip | |
Migrate to pyproject.toml
[tool.setuptools.data-files] does not support recursive directory
installation. The old setup.cfg [files] worked because PBR's
FilesConfig.expand_globs() used os.walk() to expand docker/*, but
this hook is not triggered by the pbr.build PEP-517 backend.
Move docker/ into kolla/ and use [tool.setuptools.package-data]
instead. Update kolla_worker._get_images_dir() to check the kolla
package directory first so both editable and regular installs work.
Change-Id: I4fc452c03740ef22ebbb4e8d0d86c4f4783e2d09
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'docker/horizon')
| -rw-r--r-- | docker/horizon/Dockerfile.j2 | 74 | ||||
| -rw-r--r-- | docker/horizon/extend_start.sh | 248 |
2 files changed, 0 insertions, 322 deletions
diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2 deleted file mode 100644 index 73dc65dd1..000000000 --- a/docker/horizon/Dockerfile.j2 +++ /dev/null @@ -1,74 +0,0 @@ -FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} -{% block labels %} -LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" -{% endblock %} - -{% block horizon_header %}{% endblock %} - -{% import "macros.j2" as macros with context %} - -{{ macros.configure_user(name='horizon') }} - -{% if base_package_type == 'rpm' %} - - {% set horizon_packages = [ - 'gettext' - ] %} - -{{ macros.install_packages(horizon_packages | customizable("packages")) }} -{% elif base_package_type == 'deb' %} - - {% set horizon_packages = [ - 'gettext', - 'locales', - 'tzdata' - ] %} - -{{ macros.install_packages(horizon_packages | customizable("packages")) }} - -{% endif %} - -ADD horizon-archive /horizon-source -ADD plugins-archive / - -{% set horizon_pip_packages = [ - '/horizon', - 'django_redis' -] %} - -{% set horizon_plugins_pip_packages = [ - '/plugins/*' -] %} - -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.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) }}; \ - fi \ - && for locale in /var/lib/kolla/venv/lib/python3/site-packages/*/locale; do \ - (cd ${locale%/*} && /var/lib/kolla/venv/bin/django-admin compilemessages) \ - done \ - && chmod 644 /usr/local/bin/kolla_extend_start - -{{ macros.kolla_patch_sources() }} - -{% block horizon_footer %}{% endblock %} -{% block footer %}{% endblock %} diff --git a/docker/horizon/extend_start.sh b/docker/horizon/extend_start.sh deleted file mode 100644 index d1198adb4..000000000 --- a/docker/horizon/extend_start.sh +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/bash - -set -o errexit - -FORCE_GENERATE="${FORCE_GENERATE:-no}" -HASH_PATH=/var/lib/kolla/.settings.md5sum.txt - -SITE_PACKAGES="/var/lib/kolla/venv/lib/python3/site-packages" - -MANAGE_PY="/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py" - -if [[ ! -f ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py ]]; then - ln -s /etc/openstack-dashboard/local_settings \ - ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py -fi - -if [[ -f /etc/openstack-dashboard/custom_local_settings ]]; then - CUSTOM_SETTINGS_FILE="${SITE_PACKAGES}/openstack_dashboard/local/custom_local_settings.py" - - if [[ ! -L ${CUSTOM_SETTINGS_FILE} ]]; then - ln -s /etc/openstack-dashboard/custom_local_settings ${CUSTOM_SETTINGS_FILE} - fi -fi - -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - $MANAGE_PY migrate --noinput - exit 0 -fi - -function config_dashboard { - ENABLE=$1 - SRC=$2 - DEST=$3 - if [[ ! -f ${SRC} ]]; then - echo "WARNING: ${SRC} is required" - elif [[ "${ENABLE}" == "yes" ]] && [[ ! -f "${DEST}" ]]; then - cp -a "${SRC}" "${DEST}" - FORCE_GENERATE="yes" - elif [[ "${ENABLE}" != "yes" ]] && [[ -f "${DEST}" ]]; then - # remove pyc pyo files too - rm -f "${DEST}" "${DEST}c" "${DEST}o" - FORCE_GENERATE="yes" - fi -} - -function config_blazar_dashboard { - for file in ${SITE_PACKAGES}/blazar_dashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_BLAZAR:-no}" \ - "${SITE_PACKAGES}/blazar_dashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_cloudkitty_dashboard { - for file in ${SITE_PACKAGES}/cloudkittydashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_CLOUDKITTY:-no}" \ - "${SITE_PACKAGES}/cloudkittydashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_designate_dashboard { - for file in ${SITE_PACKAGES}/designatedashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_DESIGNATE:-no}" \ - "${SITE_PACKAGES}/designatedashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_fwaas_dashboard { - for file in ${SITE_PACKAGES}/neutron_fwaas_dashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_FWAAS:-no}" \ - "${SITE_PACKAGES}/neutron_fwaas_dashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_heat_dashboard { - for file in ${SITE_PACKAGES}/heat_dashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_HEAT:-no}" \ - "${SITE_PACKAGES}/heat_dashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done - - config_dashboard "${ENABLE_HEAT:-no}" \ - "${SITE_PACKAGES}/heat_dashboard/conf/heat_policy.yaml" \ - "/etc/openstack-dashboard/heat_policy.yaml" - config_dashboard "${ENABLE_HEAT:-no}" \ - "${SITE_PACKAGES}/heat_dashboard/conf/default_policies/heat.yaml" \ - "/etc/openstack-dashboard/default_policies/heat.yaml" -} - -function config_ironic_dashboard { - for file in ${SITE_PACKAGES}/ironic_ui/enabled/_*[^__].py; do - config_dashboard "${ENABLE_IRONIC:-no}" \ - "${SITE_PACKAGES}/ironic_ui/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_magnum_dashboard { - for file in ${SITE_PACKAGES}/magnum_ui/enabled/_*[^__].py; do - config_dashboard "${ENABLE_MAGNUM:-no}" \ - "${SITE_PACKAGES}/magnum_ui/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_manila_ui { - for file in ${SITE_PACKAGES}/manila_ui/local/enabled/_*[^__].py; do - config_dashboard "${ENABLE_MANILA:-no}" \ - "${SITE_PACKAGES}/manila_ui/local/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done - - config_dashboard "${ENABLE_MANILA:-no}" \ - "${SITE_PACKAGES}/manila_ui/conf/manila_policy.yaml" \ - "/etc/openstack-dashboard/manila_policy.yaml" - config_dashboard "${ENABLE_MANILA:-no}" \ - "${SITE_PACKAGES}/manila_ui/conf/default_policies/manila.yaml" \ - "/etc/openstack-dashboard/default_policies/manila.yaml" -} - -function config_masakari_dashboard { - for file in ${SITE_PACKAGES}/masakaridashboard/local/enabled/_*[^__].py; do - config_dashboard "${ENABLE_MASAKARI:-no}" \ - "${SITE_PACKAGES}/masakaridashboard/local/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done - config_dashboard "${ENABLE_MASAKARI:-no}"\ - "${SITE_PACKAGES}/masakaridashboard/conf/masakari_policy.yaml" \ - "/etc/openstack-dashboard/masakari_policy.yaml" - config_dashboard "${ENABLE_MASAKARI:-no}"\ - "${SITE_PACKAGES}/masakaridashboard/local/local_settings.d/_50_masakari.py" \ - "${SITE_PACKAGES}/openstack_dashboard/local/local_settings.d/_50_masakari.py" -} - -function config_mistral_dashboard { - config_dashboard "${ENABLE_MISTRAL:-no}" \ - "${SITE_PACKAGES}/mistraldashboard/enabled/_50_mistral.py" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/_50_mistral.py" -} - -function config_neutron_vpnaas_dashboard { - config_dashboard "${ENABLE_NEUTRON_VPNAAS:-no}" \ - "${SITE_PACKAGES}/neutron_vpnaas_dashboard/enabled/_7100_project_vpn_panel.py" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/_7100_project_vpn_panel.py" -} - -function config_octavia_dashboard { - config_dashboard "${ENABLE_OCTAVIA:-no}" \ - "${SITE_PACKAGES}/octavia_dashboard/enabled/_1482_project_load_balancer_panel.py" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/_1482_project_load_balancer_panel.py" -} - - -function config_tacker_dashboard { - for file in ${SITE_PACKAGES}/tacker_horizon/enabled/_*[^__].py; do - config_dashboard "${ENABLE_TACKER:-no}" \ - "${SITE_PACKAGES}/tacker_horizon/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_trove_dashboard { - for file in ${SITE_PACKAGES}/trove_dashboard/enabled/_*[^__].py; do - config_dashboard "${ENABLE_TROVE:-no}" \ - "${SITE_PACKAGES}/trove_dashboard/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done -} - -function config_watcher_dashboard { - for file in ${SITE_PACKAGES}/watcher_dashboard/local/enabled/_*[^__].py; do - config_dashboard "${ENABLE_WATCHER:-no}" \ - "${SITE_PACKAGES}/watcher_dashboard/local/enabled/${file##*/}" \ - "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" - done - - config_dashboard "${ENABLE_WATCHER:-no}" \ - "${SITE_PACKAGES}/watcher_dashboard/conf/watcher_policy.json" \ - "/etc/openstack-dashboard/watcher_policy.json" -} - -# Regenerate the compressed javascript and css if any configuration files have -# changed. Use a static modification date when generating the tarball -# so that we only trigger on content changes. -function settings_bundle { - # NOTE(yoctozepto): We ignore errors here (|| true) to make it work with - # `set -o pipefail` (files might be missing - no problem). - tar -cf- --mtime=1970-01-01 \ - /etc/openstack-dashboard/local_settings \ - /etc/openstack-dashboard/custom_local_settings \ - /etc/openstack-dashboard/local_settings.d \ - /etc/openstack-dashboard/themes 2> /dev/null || true -} - -function settings_changed { - changed=1 - - if [[ ! -f $HASH_PATH ]] || ! settings_bundle | md5sum -c --status $HASH_PATH || [[ $FORCE_GENERATE == yes ]]; then - changed=0 - fi - - return ${changed} -} - -config_blazar_dashboard -config_cloudkitty_dashboard -config_designate_dashboard -config_fwaas_dashboard -config_heat_dashboard -config_ironic_dashboard -config_magnum_dashboard -config_manila_ui -config_masakari_dashboard -config_mistral_dashboard -config_neutron_vpnaas_dashboard -config_octavia_dashboard -config_tacker_dashboard -config_trove_dashboard -config_watcher_dashboard - -if settings_changed; then - ${MANAGE_PY} collectstatic --noinput --clear - ${MANAGE_PY} compress --force - settings_bundle | md5sum > $HASH_PATH -fi - -# NOTE(sbezverk) since Horizon is now storing logs in its own location, /var/log/horizon -# needs to be created if it does not exist -if [[ ! -d "/var/log/kolla/horizon" ]]; then - mkdir -p /var/log/kolla/horizon -fi - -if [[ $(stat -c %U:%G /var/log/kolla/horizon) != "horizon:kolla" ]]; then - chown -R horizon:kolla /var/log/kolla/horizon -fi - -if [[ $(stat -c %a /var/log/kolla/horizon) != "755" ]]; then - chmod 755 /var/log/kolla/horizon -fi - -if [[ -f ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store ]] && [[ $(stat -c %U ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store) != "horizon" ]]; then - chown horizon ${SITE_PACKAGES}/openstack_dashboard/local/.secret_key_store -fi |
