Hi, Please find the new debdiff for this change, which is already in Sid/Testing. We still need to test this, I hope Kevko will be able to the upgrade tests.
Cheers, Thomas Goirand (zigo)
diff -Nru horizon-14.0.2/debian/changelog horizon-14.0.2/debian/changelog --- horizon-14.0.2/debian/changelog 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/changelog 2019-12-31 17:07:32.000000000 +0100 @@ -1,3 +1,15 @@ +horizon (3:14.0.2-3+deb10u1) buster; urgency=medium + + [ Michal Arbet ] + * Fix change of WEBROOT in horizon + + [ Thomas Goirand ] + * Do not have debian local_settings.d/*.py files as CONFFILEs, as we're + editing them depending on the debconf answers (ie: we need to edit the + WEBROOT variable). + + -- Thomas Goirand <z...@debian.org> Tue, 31 Dec 2019 17:07:32 +0100 + horizon (3:14.0.2-3) unstable; urgency=medium * openstack-dashboard: Add Breaks against obsolete packages from Stretch: diff -Nru horizon-14.0.2/debian/local_settings.d/_0005_debian_webroot.py horizon-14.0.2/debian/local_settings.d/_0005_debian_webroot.py --- horizon-14.0.2/debian/local_settings.d/_0005_debian_webroot.py 1970-01-01 01:00:00.000000000 +0100 +++ horizon-14.0.2/debian/local_settings.d/_0005_debian_webroot.py 2019-12-31 17:07:32.000000000 +0100 @@ -0,0 +1,2 @@ +# To specify path for webroot, set WEBROOT = "/webroot" +WEBROOT = "/" diff -Nru horizon-14.0.2/debian/openstack-dashboard-apache.postinst horizon-14.0.2/debian/openstack-dashboard-apache.postinst --- horizon-14.0.2/debian/openstack-dashboard-apache.postinst 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard-apache.postinst 2019-12-31 17:07:32.000000000 +0100 @@ -2,6 +2,32 @@ set -e +OS_WEBROOT_CONF_PATH="/etc/openstack-dashboard/local_settings.d/_0005_debian_webroot.py" + +# We need to check if WEBROOT config will be changed +# If yes, we need to exec compress,collect_static. +# If no, it isn't needed. + +change_webroot (){ + WEBROOT=$1 + # If WEBROOT config exist, compare it + if [ -e ${OS_WEBROOT_CONF_PATH} ]; then + + CURRENT_WEBROOT=$(cat ${OS_WEBROOT_CONF_PATH} | grep ^WEBROOT | sed -e 's/"*'\''*\ *//g' | awk -F '=' '{print $2}') + + if [ "${CURRENT_WEBROOT}" = "${WEBROOT}" ]; then + echo "===> openstack-dashboard-apache: Webroot already set." + echo "===> openstack-dashboard-apache: Rebuild static not needed." + else + sed -i "s|^[ \t]*WEBROOT[ \t]=.*|WEBROOT = \"${WEBROOT}\"|" ${OS_WEBROOT_CONF_PATH} + echo "===> openstack-dashboard-apache: Setting Horizon's webroot to ${WEBROOT}" + echo "===> openstack-dashboard-apache: Horizon's webroot was changed, rebuild static is needed." + dpkg-trigger --no-await openstack-dashboard-rebuild-static + fi + fi + +} + dpkg-maintscript-helper dir_to_symlink \ /usr/share/openstack-dashboard/static /var/lib/openstack-dashboard/static 2:9.0.0~rc1-2 openstack-dashboard-apache -- "$@" @@ -26,9 +52,11 @@ db_get horizon/activate_vhost if [ "${RET}" = "true" ] && [ -x /etc/init.d/apache2 ] ; then sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=yes#' /etc/default/openstack-dashboard-apache + # Set webroot to / in openstack-dashboard settings + change_webroot "/" a2dissite 000-default.conf || true a2dissite default-ssl.conf || true - sed -i "s|^[ \t]*WEBROOT[ \t]=.*|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings.py + db_get horizon/use_ssl if [ "${RET}" = "true" ] ; then sed -i 's#[ \t]*HORIZON_USE_SSL=.*#HORIZON_USE_SSL=yes#' /etc/default/openstack-dashboard-apache @@ -52,44 +80,17 @@ else ln -fs /var/lib/openstack-dashboard/static /usr/share/openstack-dashboard/static fi - # Not needed in openstack-dashboard-apache - # This is done in openstack-dashboard - #if [ -f /usr/share/openstack-dashboard/manage.py ]; then - # /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput - # /usr/share/openstack-dashboard/manage.py compress --force - #fi - #if [ -f '/var/lib/openstack-dashboard/secret-key/.secret_key_store' ]; then - # rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store - #fi - #if [ -d /var/lib/openstack-dashboard/secret-key ]; then - # chown -R www-data /var/lib/openstack-dashboard/secret-key - #fi - #if [ -d /var/lib/openstack-dashboard/static ]; then - # chown -R www-data /var/lib/openstack-dashboard/static - #fi invoke-rc.d --quiet apache2 reload || true else sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=no#' /etc/default/openstack-dashboard-apache + # Set webroot to /horizon in openstack-dashboard settings + change_webroot "/horizon" a2ensite 000-default.conf || true a2ensite default-ssl.conf || true - sed -i "s|^[ \t]*WEBROOT[ \t]=.*|WEBROOT = '/horizon'|" /etc/openstack-dashboard/local_settings.py a2dissite openstack-dashboard.conf || true a2dissite openstack-dashboard-ssl-redirect.conf || true a2dissite openstack-dashboard-ssl.conf || true a2ensite openstack-dashboard-alias-only.conf || true - #if [ -f /usr/share/openstack-dashboard/manage.py ]; then - # /usr/share/openstack-dashboard/manage.py collectstatic --clear --noinput - # /usr/share/openstack-dashboard/manage.py compress --force - #fi - #if [ -f /var/lib/openstack-dashboard/secret-key/.secret_key_store ]; then - # rm -f /var/lib/openstack-dashboard/secret-key/.secret_key_store - #fi - #if [ -d /var/lib/openstack-dashboard/secret-key ]; then - # chown -R www-data /var/lib/openstack-dashboard/secret-key - #fi - #if [ -d /var/lib/openstack-dashboard/static ]; then - # chown -R www-data /var/lib/openstack-dashboard/static - #fi invoke-rc.d --quiet apache2 reload || true fi db_stop diff -Nru horizon-14.0.2/debian/openstack-dashboard.dirs horizon-14.0.2/debian/openstack-dashboard.dirs --- horizon-14.0.2/debian/openstack-dashboard.dirs 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard.dirs 2019-12-31 17:07:32.000000000 +0100 @@ -1 +1,2 @@ +/etc/openstack-dashboard/local_settings.d /usr/share/openstack-dashboard diff -Nru horizon-14.0.2/debian/openstack-dashboard.install horizon-14.0.2/debian/openstack-dashboard.install --- horizon-14.0.2/debian/openstack-dashboard.install 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard.install 2019-12-31 17:07:32.000000000 +0100 @@ -1,2 +1,3 @@ usr/share/openstack-dashboard etc/openstack-dashboard +debian/local_settings.d/* usr/share/openstack-dashboard-debian-settings.d diff -Nru horizon-14.0.2/debian/openstack-dashboard.postinst horizon-14.0.2/debian/openstack-dashboard.postinst --- horizon-14.0.2/debian/openstack-dashboard.postinst 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard.postinst 2019-12-31 17:07:32.000000000 +0100 @@ -50,6 +50,18 @@ if [ "$1" = "configure" ] ; then . /usr/share/debconf/confmodule + # Copy over the files to /etc/openstack-dashboard/local_settings.d + # *once*, then never do it again (as users may decide to handle configuration + # in a different way than we may think). + if [ ! -e /usr/share/openstack-dashboard-debian-settings.d/copied ] ; then + mkdir -p /etc/openstack-dashboard/local_settings.d + for i in $(find /usr/share/openstack-dashboard-debian-settings.d -type f -iname '*.py') ; do + BASENAME=$(basename $i) + install -D $i /etc/openstack-dashboard/local_settings.d/${BASENAME} + done + touch /usr/share/openstack-dashboard-debian-settings.d/copied + fi + # Create a new horizon user ### if ! getent group horizon > /dev/null 2>&1 ; then addgroup --quiet --system horizon diff -Nru horizon-14.0.2/debian/openstack-dashboard.postrm horizon-14.0.2/debian/openstack-dashboard.postrm --- horizon-14.0.2/debian/openstack-dashboard.postrm 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard.postrm 2019-12-31 17:07:32.000000000 +0100 @@ -10,6 +10,7 @@ rm -rf /var/lib/openstack-dashboard rm -rf /var/lib/horizon rm -rf /usr/share/openstack-dashboard + rm -rf /usr/share/openstack-dashboard-debian-settings.d rmdir --ignore-fail-on-non-empty /etc/openstack-dashboard || true fi diff -Nru horizon-14.0.2/debian/openstack-dashboard.triggers horizon-14.0.2/debian/openstack-dashboard.triggers --- horizon-14.0.2/debian/openstack-dashboard.triggers 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/openstack-dashboard.triggers 2019-12-31 17:07:32.000000000 +0100 @@ -36,3 +36,5 @@ interest-noawait /usr/lib/python3/dist-packages/horizon interest-noawait /usr/lib/python3/dist-packages/openstack_dashboard interest-noawait /usr/lib/python3/dist-packages/openstack_auth +# Named trigger which should be called from openstack-dashboard-apache +interest-noawait openstack-dashboard-rebuild-static diff -Nru horizon-14.0.2/debian/rules horizon-14.0.2/debian/rules --- horizon-14.0.2/debian/rules 2019-03-25 21:44:52.000000000 +0100 +++ horizon-14.0.2/debian/rules 2019-12-31 17:07:32.000000000 +0100 @@ -74,9 +74,6 @@ # Secret key has to be replaced here sed -i -e 's/os.path.join(LOCAL_PATH,/os.path.join("\/","var","lib","openstack-dashboard","secret-key",/' $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/examples/local_settings.py - # Debian specific configuration - cp $(CURDIR)/debian/local_settings.d/*.py $(CURDIR)/debian/tmp/etc/openstack-dashboard/local_settings.d/ - # Move osprofiler conf files to be enabled to standard location # and remove /usr/lib/python3/dist-packages/openstack_dashboard/contrib/developer/enabled mv -f $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/openstack_dashboard/contrib/developer/enabled/_[0-9]*.py \