[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#945592: buster-pu: package openstack-dashboard-apache/3:14.0.2-3



Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian.org@packages.debian.org
Usertags: pu

Hi,

Openstack-dashboard-apache package is used to configure apache2 to provide
openstack-dashboard (horizon) and also configure openstack-dashboard's webroot.

As upstream moved WEBROOT variable from local_settings.py to defaults.py, it has
to been overriden in /etc/openstack-dashboard/local_settings.d and openstack-dashboard-apache
has to configure this variable and rebuild static files if needed.

This is now achieved by openstack-dashboard-apache which is calling trigger of openstack-dashboard
when needed.

-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'oldstable-updates'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/32 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
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-11-27 15:32:02.000000000 +0100
@@ -1,3 +1,9 @@
+horizon (3:14.0.2-3+deb10u1) buster; urgency=medium
+
+  * Fix change od WEBROOT in horizon
+
+ -- Michal Arbet <michal.arbet@ultimum.io>  Wed, 27 Nov 2019 15:32:02 +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-11-27 15:31:56.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-11-27 15:31:56.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 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.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-11-27 15:31:56.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 rebuild-static

Reply to: