diff options
| author | Lars Kellogg-Stedman <lars@redhat.com> | 2018-06-27 13:34:26 -0400 |
|---|---|---|
| committer | Lars Kellogg-Stedman <lars@redhat.com> | 2018-08-14 11:15:33 -0400 |
| commit | 863f565b08867b87f3df7d1fc091ac26be90a1e8 (patch) | |
| tree | 55866dee6c7e4e803c5db06ff9e66840dfaf2e08 /docker | |
| parent | 8d44e3b5a4837f454856b80f032c4ad17325a595 (diff) | |
| download | kolla-863f565b08867b87f3df7d1fc091ac26be90a1e8.tar.gz kolla-863f565b08867b87f3df7d1fc091ac26be90a1e8.zip | |
horizon: regenerate compressed javascript and css on configuration changes
previously, the horizon container would not re-rerun the manage.py
collectstatic/compress tasks when configuration files in
/etc/openstack-dashboard/local-settings.d were modified (or added or
deleted). This commit modifies the checksum calculation to take all
configuration files into account.
Closes-bug: 1778963
Change-Id: I6946ab96cd758ef6eed56c9c4130046ac884b5e3
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/horizon/extend_start.sh | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/docker/horizon/extend_start.sh b/docker/horizon/extend_start.sh index 3bb6c7da2..cf250ce6d 100644 --- a/docker/horizon/extend_start.sh +++ b/docker/horizon/extend_start.sh @@ -276,18 +276,25 @@ 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 +# 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 { + tar -cf- --mtime=1970-01-01 \ + /etc/openstack-dashboard/local_settings \ + /etc/openstack-dashboard/custom_local_settings \ + /etc/openstack-dashboard/local_settings.d 2> /dev/null +} + 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 + changed=1 + hash_path=/var/lib/kolla/.settings.md5sum.txt + + if [[ ! -f $hash_path ]] || ! settings_bundle | md5sum -c --status $hash_path || [[ $FORCE_GENERATE == yes ]]; then + changed=0 + settings_bundle | md5sum > $hash_path + fi + return ${changed} } |
