]> review.fuel-infra Code Review - openstack-build/horizon-build.git/commitdiff
Added a /etc/defaults/openstack-dashboard-apache to save the values of debconf for...
authorThomas Goirand <thomas@goirand.fr>
Fri, 14 Jun 2013 18:45:25 +0000 (02:45 +0800)
committerThomas Goirand <thomas@goirand.fr>
Fri, 14 Jun 2013 18:47:08 +0000 (02:47 +0800)
Rewritten-From: 61eb48465bfded8724f304e603902cf2a10d0fe3

trusty/debian/changelog
trusty/debian/openstack-dashboard-apache.config
trusty/debian/openstack-dashboard-apache.postinst
trusty/debian/openstack-dashboard-apache.postrm [new file with mode: 0644]
trusty/debian/openstack-dashboard-apache.prerm

index a304ee9f56c4ec5d9d62adf2bc514d89e4d80dae..1d035f751bcf03dbc370104d0eb8e455936dcdc1 100644 (file)
@@ -1,3 +1,10 @@
+horizon (2013.1.2-2) unstable; urgency=low
+
+  * Added a /etc/default/openstack-dashboard-apache to save the values of
+    debconf about setting-up the Apache vhosts.
+
+ -- Thomas Goirand <zigo@debian.org>  Sat, 15 Jun 2013 02:45:58 +0800
+
 horizon (2013.1.2-1) unstable; urgency=low
 
   * New upstream release.
index 76b4bb2d1d77fe8b485454a54149aa409e2c0194..bee638ee651b15f995334f69031fceb1ba2de873 100644 (file)
@@ -4,11 +4,27 @@ set -e
 
 . /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
index 57076f32c46efe51afd418ae07e27b568b1260df..da446d94311c2043186bf1b417c53739a6fba666 100644 (file)
@@ -3,23 +3,44 @@
 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
diff --git a/trusty/debian/openstack-dashboard-apache.postrm b/trusty/debian/openstack-dashboard-apache.postrm
new file mode 100644 (file)
index 0000000..e3bebbf
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "${1}" = "purge" ] ; then
+       if [ -f /etc/default/openstack-dashboard-apache ] ; then
+               rm -rf /etc/default/openstack-dashboard-apache
+       fi
+fi
+
+#DEBHELPER#
index 0068cfbecdcf48ef452cf32864e1381853b62975..d0149a6d8512e1fe8cc0a7977aa3890d6ea15334 100644 (file)
@@ -2,8 +2,10 @@
 
 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#