Skip to content

Commit

Permalink
Enable watcher-dashboard panels if ENABLE_WATCHER is yes
Browse files Browse the repository at this point in the history
Following the same pattern that other plugins, this patch enable the
pannels provided in the wathcher-dashboard if environmental value is set
to `yes`.

To make it backwards compatible it is setting it as no by default and
checks if the dashboard is installed before trying to enable it.
  • Loading branch information
amoralej committed Jan 31, 2025
1 parent a013801 commit bd2fa10
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions container-images/kolla/horizon/extend_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ HASH_PATH=/var/lib/kolla/.settings.md5sum.txt
MANAGE_PY="/usr/bin/python3 /usr/bin/manage.py"
PYTHON_VERSION=$(python3 --version | awk '{print $2}' | awk -F'.' '{print $1"."$2}')
SITE_PACKAGES="/usr/lib/python${PYTHON_VERSION}/site-packages"
# There may not be ENABLE_WATCHER variable. Defaulting it to no.
ENABLE_WATCHER="${ENABLE_WATCHER:-no}"

if [[ -f /etc/openstack-dashboard/custom_local_settings ]]; then
CUSTOM_SETTINGS_FILE="${SITE_PACKAGES}/openstack_dashboard/local/custom_local_settings.py"
Expand Down Expand Up @@ -80,6 +82,17 @@ function config_octavia_dashboard {
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/_1482_project_load_balancer_panel.py"
}

function config_watcher_dashboard {
# Do nothing if the watcher-dashboard is not installed
if [ -d ${SITE_PACKAGES}/watcher_dashboard ] ; then
for file in ${SITE_PACKAGES}/watcher_dashboard/local/enabled/_*[^__].py; do
config_dashboard "${ENABLE_WATCHER}" \
"${SITE_PACKAGES}/watcher_dashboard/local/enabled/${file##*/}" \
"${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}"
done
fi
}

# 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.
Expand All @@ -105,6 +118,7 @@ config_heat_dashboard
config_ironic_dashboard
config_manila_ui
config_octavia_dashboard
config_watcher_dashboard

if settings_changed; then
${MANAGE_PY} collectstatic --noinput --clear
Expand Down

0 comments on commit bd2fa10

Please sign in to comment.