. /usr/share/debconf/confmodule
+if [ -r /etc/default/openstack-dashboard-apache ] ; then
+ . /etc/default/openstack-dashboard-apache
+fi
+
+if [ "${HORIZON_ACTIVATE_VHOSTS}" = "true" ] || [ "${HORIZON_ACTIVATE_VHOSTS}" = "yes" ] ; then
+ db_set horizon/activate_vhost true
+else
+ db_set horizon/activate_vhost false
+fi
+
db_input high horizon/activate_vhost || true
db_go || true
db_get horizon/activate_vhost
if [ "${RET}" = "true" ] ; then
+ if [ "${HORIZON_USE_SSL}" = "true" ] || [ "${HORIZON_USE_SSL}" = "yes" ] ; then
+ db_set horizon/use_ssl true
+ else
+ db_set horizon/use_ssl false
+ fi
+
db_input high horizon/use_ssl || true
db_go || true
fi
set -e
if [ "$1" = "configure" ] ; then
- . /usr/share/debconf/confmodule
- db_get horizon/activate_vhost
- if [ "${RET}" = "true" ] && [ -x /etc/init.d/apache2 ] ; then
+ . /usr/share/debconf/confmodule
+ if ! [ -f /etc/default/openstack-dashboard-apache ] ; then
+ echo "# This file controls the behavior of the
+# Apache installation / upgrade.
+
+# Controls if the Apache \"default\" site provided by the Debian
+# Apache package should be disabled, and the \"openstack-dashboard\"
+# virtual host enabled. If set to no, then you will have to do the
+# setup manually.
+HORIZON_ACTIVATE_VHOSTS=yes
+
+# If the above HORIZON_ACTIVATE_VHOSTS is set to yes, the
+# below directive is set to yes also, then Horizon will
+# be setup using SSL, and any query to the non-SSL site
+# will be redirected to the SSL site.
+HORIZON_USE_SSL=yes" >/etc/default/openstack-dashboard-apache
+ fi
+ 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
a2dissite default
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
a2enmod ssl
a2enmod rewrite
a2dissite openstack-dashboard
a2ensite openstack-dashboard-ssl-redirect
a2ensite openstack-dashboard-ssl
else
+ sed -i 's#[ \t]*HORIZON_USE_SSL=.*#HORIZON_USE_SSL=no#' /etc/default/openstack-dashboard-apache
a2dissite openstack-dashboard-ssl
a2dissite openstack-dashboard-ssl-redirect
a2ensite openstack-dashboard
fi
invoke-rc.d --quiet apache2 reload
+ else
+ sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=no#' /etc/default/openstack-dashboard-apache
fi
db_stop
fi
set -e
-a2dissite openstack-dashboard
-a2dissite openstack-dashboard-ssl-redirect
-a2dissite openstack-dashboard-ssl
+if [ -x /usr/sbin/a2dissite ] ; then
+ a2dissite openstack-dashboard
+ a2dissite openstack-dashboard-ssl-redirect
+ a2dissite openstack-dashboard-ssl
+fi
-#DEBHELPER#
\ No newline at end of file
+#DEBHELPER#