Create symlink if /e/o-d/customer_local_settings exists

Create site-packages custom_local_settings symlink if /etc/openstack-dashboard/custom_
local_settings exists, this will be used as a mechanism to extend the
current local_settings without a need to change the file and rebuild
the image

Change-Id: I06221de3633d1ad30160bfc83d53a3b98f586f39
Partial-Bug: #1769970
Signed-off-by: Jorge Niedbalski <jorge.niedbalski@linaro.org>
This commit is contained in:
Jorge Niedbalski 2018-05-08 15:47:43 -03:00
parent 59ec7c7cf2
commit 479daab59b

View File

@ -15,6 +15,11 @@ if [[ ${KOLLA_INSTALL_TYPE} == "source" ]] && [[ ! -f ${SITE_PACKAGES}/openstack
${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py
fi
if [[ -f /etc/openstack-dashboard/custom_local_settings ]] && [[ ! -f ${SITE_PACKAGES}/openstack_dashboard/local/custom_local_settings.py ]]; then
ln -s /etc/openstack-dashboard/custom_local_settings \
${SITE_PACKAGES}/openstack_dashboard/local/custom_local_settings.py
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
@ -251,6 +256,21 @@ function config_zun_dashboard {
done
}
# NOTE(jeffrey4l, niedbalski): The local_settings and custom_local_settings files
# affect django-compress behavior, so re-generate the compressed
# javascript and css if any of those setting files changed
function settings_changed {
declare -A settings=( ['/etc/openstack-dashboard/local_settings']="/var/lib/kolla/.local_settings.md5sum.txt" ['/etc/openstack-dashboard/custom_local_settings']="/var/lib/kolla/.custom_local_settings.md5sum.txt")
declare -x changed=1
for path in "${!settings[@]}"; do
if [[ ! -f ${settings[$path]} || $(md5sum -c --status ${settings[$path]};echo $?) != 0 || ${FORCE_GENERATE} == "yes" ]]; then
changed=0
md5sum ${path} > ${settings[$path]}
fi
done
return ${changed}
}
config_blazar_dashboard
config_cloudkitty_dashboard
config_designate_dashboard
@ -286,12 +306,7 @@ else
rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
fi
# NOTE(jeffrey4l): The local_settings file affect django-compress
# behavior, so re-generate the compressed javascript and css if it
# is changed
MD5SUM_TXT_PATH="/var/lib/kolla/.local_settings.md5sum.txt"
if [[ ! -f ${MD5SUM_TXT_PATH} || $(md5sum -c --status ${MD5SUM_TXT_PATH};echo $?) != 0 || ${FORCE_GENERATE} == "yes" ]]; then
md5sum /etc/openstack-dashboard/local_settings > ${MD5SUM_TXT_PATH}
if settings_changed; then
if [[ "${KOLLA_INSTALL_TYPE}" == "binary" ]]; then
/usr/bin/manage.py collectstatic --noinput --clear
/usr/bin/manage.py compress --force