From: Thomas Goirand Date: Thu, 2 Jul 2015 01:10:17 +0000 (+0200) Subject: Fix numerous issues in the Horizon package X-Git-Tag: mos-9.0~20 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F8945%2F37;p=openstack-build%2Fhorizon-build.git Fix numerous issues in the Horizon package The Horizon package comming from Ubuntu has numerous issues, and this patch attemps to fix some of them. There's some less important things which could be fixed later on. * Adds missing symlinks to horizon to fix broken offline compress, which made the package uninstallable (LP: #1470143). * Ran wrap-and-sort -t -a to make dependencies readable. * Run compile-messages at build time, not in postinst. * Activates off-line compress. * Fix path of secret-key to be in /var (as /usr should be considered to be a read-only filesystem, as per Debian policy). * Copy the missing angular folder. * debian/openstack-dashboard.postinst - Re-wrapped the file which was really unreadable in its current state. - Redefines --home as /var/lib/horizon, and not /usr/share/horizon, which really is not policy compliant (in openstack-dashboard.postinst). - Completely remove the collecstatic which should *never* be done in this package: we're not using a virtualenv! - Completely remove chown of files in /usr. By policy of the FSHS, this should *never* happen. - Removed chown of /etc/openstack-dashboard. This is useless and dangerous in therms of security. - Avoids hacks with the secret-key folder in postinst (since we've set that by default to be /var in the default config file). - Add off-line compress if triggered. * Add trigger if the some javascripts are updated. * Fixes /horizon/static Alias directives (thanks to I. Yozhikov). * Fixes in _variables.scss for /horizon/ webroot * Activating OFFLINE_COMPRESS=True, which speeds up a lot Horizon. * Fix the way /var/lib/openstack-dashboard/secret_key is handled (previously a copy of /etc/openstack-dashboard, now an alias to it). * Fix tests to not try to overwrite the package apache config. Closes-Bug: #1470143 Change-Id: I7de1968ff9c1ddd03a9965aa66fb9407d3f8d1dd --- diff --git a/tests/runtests.sh b/tests/runtests.sh index 47b6fbf..7991887 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -2,6 +2,8 @@ RES=0 +DISTR=`head -1 /etc/issue | grep -P -o '^[A-z]+'` + horizon_apache_conf() { echo -e " ServerName localhost @@ -16,30 +18,18 @@ horizon_apache_conf() { case $1 in openstack-dashboard) - python -c "import lesscpy" - if [ $? -ne '0' ]; then - echo "We have missed lesscpy dependency" - RES=1 - exit $RES - fi - - if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]]; then - apache="apache2" - chown -R horizon:horizon /usr/share/openstack-dashboard - sed -i "s/\#ALLOWED_HOSTS = \[.*/ALLOWED_HOSTS = \['127.0.0.1', \]/g" /etc/openstack-dashboard/local_settings.py - else - apache="httpd" - chown -R apache:apache /usr/share/openstack-dashboard - sed -i "s/LOCAL_PATH = .*/LOCAL_PATH = '\/tmp'/g" /etc/openstack-dashboard/local_settings + if [ "$DISTR" = "Ubuntu" ] || [ "$DISTR" = "Debian" ] ; then + apache="apache2" + elif [ "$DISTR" = "CentOS" ]; then + apache="httpd" + chown -R apache:apache /usr/share/openstack-dashboard + sed -i "s/LOCAL_PATH = .*/LOCAL_PATH = '\/tmp'/g" /etc/openstack-dashboard/local_settings + horizon_apache_conf + a2dissite 000-default fi - horizon_apache_conf - # Disable default configuration - a2dissite 000-default - service $apache restart - - wget http://127.0.0.1 -O - | grep 'Login - OpenStack Dashboard' + wget http://127.0.0.1/horizon -O - | grep 'Login - OpenStack Dashboard' RES=$? ;; python-django-horizon) diff --git a/trusty/debian/changelog b/trusty/debian/changelog index a067a93..9f5e7fd 100644 --- a/trusty/debian/changelog +++ b/trusty/debian/changelog @@ -1,5 +1,6 @@ horizon (1:2015.1.0-1~u14.04+mos5) mos7.0; urgency=medium + [ Daniil Trishkin ] * debian/control: - Add horizon-doc package section - Add python-oslosphinx to build dependencies @@ -8,7 +9,36 @@ horizon (1:2015.1.0-1~u14.04+mos5) mos7.0; urgency=medium - Add override_dh_sphinxdoc section * Add debian/horizon-doc.doc-base - -- Daniil Trishkin Fri, 03 Jul 2015 18:13:47 +0300 + [ Thomas Goirand ] + * Adds missing symlinks to horizon to fix broken offline compress, which + made the package uninstallable (LP: #1470143). + * Ran wrap-and-sort -t -a to make dependencies readable. + * Run compile-messages at build time, not in postinst. + * Activates off-line compress. + * Fix path of secret-key to be in /var (as /usr should be considered to be a + read-only filesystem, as per Debian policy). + * Copy the missing angular folder. + * debian/openstack-dashboard.postinst + - Re-wrapped the file which was really unreadable in its current state. + - Redefines --home as /var/lib/horizon, and not /usr/share/horizon, which + really is not policy compliant (in openstack-dashboard.postinst). + - Completely remove the collecstatic which should *never* be done in this + package: we're not using a virtualenv! + - Completely remove chown of files in /usr. By policy of the FSHS, this + should *never* happen. + - Removed chown of /etc/openstack-dashboard. This is useless and + dangerous in therms of security. + - Avoids hacks with the secret-key folder in postinst (since we've set + that by default to be /var in the default config file). + - Add off-line compress if triggered. + * Add trigger if the some javascripts are updated. + * Fixes /horizon/static Alias directives (thanks to I. Yozhikov). + * Activating OFFLINE_COMPRESS=True, which speeds up a lot Horizon. + * Fix the way /var/lib/openstack-dashboard/secret_key is handled + (previously a copy of /etc/openstack-dashboard/secret_key, now an alias to + it). + + -- Thomas Goirand Thu, 02 Jul 2015 02:35:51 +0200 horizon (1:2015.1.0-1~u14.04+mos4) mos7.0; urgency=medium diff --git a/trusty/debian/compile-messages b/trusty/debian/compile-messages new file mode 100644 index 0000000..4079622 --- /dev/null +++ b/trusty/debian/compile-messages @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e +set -x + +CURDIR=`pwd` +cd horizon +${CURDIR}/manage.py compilemessages +cd .. +cd openstack_dashboard +${CURDIR}/manage.py compilemessages +cd .. +rm -vf horizon/locale/en/LC_MESSAGES/django*.mo +rm -vf openstack_dashboard/locale/en/LC_MESSAGES/django.mo diff --git a/trusty/debian/control b/trusty/debian/control index b8ee774..f718e99 100644 --- a/trusty/debian/control +++ b/trusty/debian/control @@ -2,104 +2,166 @@ Source: horizon Section: net Priority: extra Maintainer: MOS Horizon Team -Build-Depends: - debhelper (>= 9), - pylint (>= 1.3.0), - python-all (>= 2.7.1), - python-django-nose, - python-lesscpy, - python-mox, - python-netaddr (>= 0.7.12), - python-nose, - python-oslosphinx (>= 2.5.0), - python-pbr (>= 0.10), - python-setuptools, - python-sphinx (>= 1.1.2) +Build-Depends: debhelper (>= 9), + dh-python, + openstack-pkg-tools, + python-all, + python-pbr (>= 0.10), + python-setuptools, + python-sphinx, +Build-Depends-Indep: gettext, + pylint (>= 1.3.0), + python-babel, + python-ceilometerclient (>= 1.0.13), + python-cinderclient (>= 1:1.1.0), + python-compressor, + python-coverage, + python-django, + python-django-nose, + python-django-pyscss, + python-eventlet (>= 0.16.1), + python-glanceclient (>= 1:0.15.0), + python-hacking, + python-heatclient (>= 0.3.0), + python-httplib2, + python-iso8601, + python-keystoneclient (>= 1:1.1.0), + python-kombu, + python-lesscpy, + python-mock, + python-mox, + python-netaddr, + python-netaddr (>= 0.7.12), + python-neutronclient (>= 2.3.11), + python-nose, + python-nose-exclude, + python-nosehtmloutput, + python-nosexcover, + python-novaclient (>= 1:2.22.0), + python-openstack-auth (>= 1.1.7), + python-openstack.nose-plugin, + python-oslo.concurrency (>= 1.8.0), + python-oslo.config (>= 1:1.9.3), + python-oslo.i18n (>= 1.5.0), + python-oslo.serialization (>= 1.4.0), + python-oslo.utils (>= 1.4.0), + python-oslosphinx (>= 2.5.0), + python-pint, + python-pyscss, + python-saharaclient (>= 0.8.0), + python-six (>= 1.9.0), + python-swiftclient, + python-testtools, + python-troveclient (>= 1.0.7), + python-tz, + python-xstatic, + python-xstatic-angular (>= 1.3.7), + python-xstatic-angular-bootstrap, + python-xstatic-angular-lrdragndrop, + python-xstatic-bootstrap-datepicker (>= 0.0.0.1-3~), + python-xstatic-bootstrap-scss (>= 3), + python-xstatic-d3, + python-xstatic-font-awesome, + python-xstatic-hogan, + python-xstatic-jasmine (>= 2.1.2.0), + python-xstatic-jquery, + python-xstatic-jquery-migrate, + python-xstatic-jquery-ui (>= 1.10.1), + python-xstatic-jquery.quicksearch, + python-xstatic-jquery.tablesorter, + python-xstatic-jsencrypt, + python-xstatic-magic-search, + python-xstatic-qunit, + python-xstatic-rickshaw, + python-xstatic-smart-table, + python-xstatic-spin, + python-xstatic-term.js, + python-yaml, +Build-Conflicts: python-rednose, + python-unittest2, Standards-Version: 3.9.3 Homepage: http://launchpad.net/horizon Package: python-django-horizon Section: python Architecture: all -Depends: - python-pbr (>= 0.10), - python-babel (>= 1.3), - python-django (>= 1.4.2), - gettext, - python-pint (>= 0.5), - python-cloudfiles, - python-compressor (>= 1.4), - python-openstack-auth (>= 1.1.7), - python-django-pyscss (>= 1.0.3), - python-eventlet (>= 0.16.1), - python-httplib2 (>= 0.7.5), - python-iso8601 (>= 0.1.9), - python-kombu (>= 2.5.0), - python-lesscpy, - python-lockfile (>= 1:0.8), - python-memcache, - python-netaddr (>= 0.7.12), - python-oslo.concurrency (>= 1.8.0), - python-oslo.config (>= 1:1.9.3), - python-oslo.i18n (>= 1.5.0), - python-oslo.serialization (>= 1.4.0), - python-oslo.utils (>= 1.4.0), - python-pyscss (>= 1.2.1), - python-ceilometerclient (>= 1.0.13), - python-cinderclient (>= 1:1.1.0), - python-glanceclient (>= 1:0.15.0), - python-heatclient (>= 0.3.0), - python-keystoneclient (>= 1:1.1.0), - python-neutronclient (>= 1:2.3.11), - python-novaclient (>= 1:2.22.0), - python-saharaclient (>= 0.8.0), - python-swiftclient (>= 1:2.2.0), - python-troveclient (>= 1:1.0.7), - python-tz (>= 2013.6), - python-yaml (>= 3.1.0), - python-six (>= 1.9.0), - python-xstatic (>= 1.0.0), - python-xstatic-angular (>= 1.3.7), - python-xstatic-angular-bootstrap (>= 0.11.0.2), - python-xstatic-angular-lrdragndrop (>= 1.0.2.2), - python-xstatic-bootstrap-datepicker (>= 1.3.1.0), - python-xstatic-bootstrap-scss (>= 3), - python-xstatic-d3 (>= 3.1.6.2), - python-xstatic-hogan (>= 2.0.0.2), - python-xstatic-font-awesome (>= 4.2.0), - python-xstatic-jasmine (>= 2.1.2.0), - python-xstatic-jquery (>= 1.7.2), - python-xstatic-jquery-migrate (>= 1.2.1.1), - python-xstatic-jquery.quicksearch (>= 2.0.3.1), - python-xstatic-jquery.tablesorter (>= 2.0.5b.0), - python-xstatic-jquery-ui (>= 1.10.1), - python-xstatic-jsencrypt (>= 2.0.0.2), - python-xstatic-magic-search (>= 0.2.0.1), - python-xstatic-qunit (>= 1.14.0.2), - python-xstatic-rickshaw (>= 1.5.0), - python-xstatic-smart-table (>= 1.4.5.3), - python-xstatic-spin (>= 1.2.5.2), - python-xstatic-term.js (>= 0.0.4), - ${misc:Depends}, - ${python:Depends} -Recommends: memcached -Suggests: python-lesscpy +Depends: gettext, + python-babel (>= 1.3), + python-ceilometerclient (>= 1.0.13), + python-cinderclient (>= 1:1.1.0), + python-cloudfiles, + python-compressor (>= 1.4), + python-django (>= 1.4.2), + python-django-pyscss (>= 1.0.3), + python-eventlet (>= 0.16.1), + python-glanceclient (>= 1:0.15.0), + python-heatclient (>= 0.3.0), + python-httplib2 (>= 0.7.5), + python-iso8601 (>= 0.1.9), + python-keystoneclient (>= 1:1.1.0), + python-kombu (>= 2.5.0), + python-lesscpy, + python-lockfile (>= 1:0.8), + python-memcache, + python-netaddr (>= 0.7.12), + python-neutronclient (>= 1:2.3.11), + python-novaclient (>= 1:2.22.0), + python-openstack-auth (>= 1.1.7), + python-oslo.concurrency (>= 1.8.0), + python-oslo.config (>= 1:1.9.3), + python-oslo.i18n (>= 1.5.0), + python-oslo.serialization (>= 1.4.0), + python-oslo.utils (>= 1.4.0), + python-pbr (>= 0.10), + python-pint (>= 0.5), + python-pyscss (>= 1.2.1), + python-saharaclient (>= 0.8.0), + python-six (>= 1.9.0), + python-swiftclient (>= 1:2.2.0), + python-troveclient (>= 1:1.0.7), + python-tz (>= 2013.6), + python-xstatic (>= 1.0.0), + python-xstatic-angular (>= 1.3.7), + python-xstatic-angular-bootstrap (>= 0.11.0.2), + python-xstatic-angular-lrdragndrop (>= 1.0.2.2), + python-xstatic-bootstrap-datepicker (>= 1.3.1.0), + python-xstatic-bootstrap-scss (>= 3), + python-xstatic-d3 (>= 3.1.6.2), + python-xstatic-font-awesome (>= 4.2.0), + python-xstatic-hogan (>= 2.0.0.2), + python-xstatic-jasmine (>= 2.1.2.0), + python-xstatic-jquery (>= 1.7.2), + python-xstatic-jquery-migrate (>= 1.2.1.1), + python-xstatic-jquery-ui (>= 1.10.1), + python-xstatic-jquery.quicksearch (>= 2.0.3.1), + python-xstatic-jquery.tablesorter (>= 2.0.5b.0), + python-xstatic-jsencrypt (>= 2.0.0.2), + python-xstatic-magic-search (>= 0.2.0.1), + python-xstatic-qunit (>= 1.14.0.2), + python-xstatic-rickshaw (>= 1.5.0), + python-xstatic-smart-table (>= 1.4.5.3), + python-xstatic-spin (>= 1.2.5.2), + python-xstatic-term.js (>= 0.0.4), + python-yaml (>= 3.1.0), + ${misc:Depends}, + ${python:Depends}, +Recommends: memcached, +Suggests: python-lesscpy, Description: Django module providing web based interaction with OpenStack The Django-Nova project is a Django module that is used to provide web based interactions with the OpenStack Nova cloud controller. Package: openstack-dashboard -Provides: sahara-dashboard -Replaces: sahara-dashboard +Provides: sahara-dashboard, +Replaces: sahara-dashboard, Architecture: all -Pre-Depends: dpkg (>= 1.15.7.2) -Depends: - adduser, - apache2 | httpd, - libapache2-mod-wsgi (>= 2.3), - python-django-horizon (= ${source:Version}), - ${misc:Depends}, - ${python:Depends} +Pre-Depends: dpkg (>= 1.15.7.2), +Depends: adduser, + apache2 | httpd, + libapache2-mod-wsgi (>= 2.3), + python-django-horizon (= ${source:Version}), + ${misc:Depends}, + ${python:Depends}, Description: django web interface to Openstack The OpenStack Dashboard is a reference implementation of a Django site that uses the Django-Nova project to provide web based interactions with the @@ -115,4 +177,4 @@ Description: uses the Django-Nova project to provide web based interactions with the OpenStack Nova cloud controller. . - This package contains the documentation. \ No newline at end of file + This package contains the documentation. diff --git a/trusty/debian/openstack-dashboard.conf b/trusty/debian/openstack-dashboard.conf index 1dfc262..8f3ad7a 100755 --- a/trusty/debian/openstack-dashboard.conf +++ b/trusty/debian/openstack-dashboard.conf @@ -1,8 +1,14 @@ WSGIScriptAlias /horizon /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi WSGIDaemonProcess horizon user=horizon group=horizon processes=3 threads=10 WSGIProcessGroup horizon -Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static/ +Alias /horizon/static /usr/share/openstack-dashboard/openstack_dashboard/static/ +Alias /horizon/media /usr/share/openstack-dashboard/openstack_dashboard/static/ Order allow,deny Allow from all + + Options +FollowSymLinks -SymLinksIfOwnerMatch + Order allow,deny + Allow from all + diff --git a/trusty/debian/openstack-dashboard.links b/trusty/debian/openstack-dashboard.links index 7f7eb04..c5ba665 100644 --- a/trusty/debian/openstack-dashboard.links +++ b/trusty/debian/openstack-dashboard.links @@ -1,2 +1,6 @@ -/usr/share/openstack-dashboard/openstack_dashboard/static /usr/share/openstack-dashboard/static /usr/bin/lessc /usr/share/openstack-dashboard/bin/less/lessc +/usr/share/openstack-dashboard/openstack_dashboard/static /usr/share/openstack-dashboard/static +/var/lib/openstack-dashboard/static/scss /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss +/var/lib/openstack-dashboard/static/css /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css +/var/lib/openstack-dashboard/static/js /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/js +/usr/share/fonts-font-awesome/fonts /usr/share/pyshared/horizon/static/horizon/lib/font-awesome/fonts diff --git a/trusty/debian/openstack-dashboard.postinst b/trusty/debian/openstack-dashboard.postinst index ac79cc2..a7f4736 100644 --- a/trusty/debian/openstack-dashboard.postinst +++ b/trusty/debian/openstack-dashboard.postinst @@ -5,76 +5,82 @@ set -e CONF="openstack-dashboard.conf" -if [ "$1" = "configure" ]; then - # /etc/apache2/conf.d/dashboard.conf -> /etc/apache2/conf-available/openstack-dashboard.conf - dpkg-maintscript-helper mv_conffile \ - /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf-available/$CONF \ - 2012.1~rc1-0ubuntu1 -- "$@" - - # Transition config to apache 2.4 compatable location. - dpkg-maintscript-helper mv_conffile \ - /etc/apache2/conf.d/$CONF \ - /etc/apache2/conf-available/$CONF \ - 1:2013.2~b2-0ubuntu3 -- "$@" - - if ! getent group horizon > /dev/null 2>&1 - then - addgroup --system horizon >/dev/null - fi - if ! getent passwd horizon > /dev/null 2>&1 - then - adduser --system --home /usr/share/openstack-dashboard/ --ingroup horizon \ - --no-create-home --shell /bin/false horizon - fi - - ( - cd /usr/share/openstack-dashboard - echo "Collecting and compressing static assets..." - rm -rf ./static/horizon 2>&1 > /dev/null - python manage.py collectstatic --noinput 2>&1 > /dev/null - python manage.py compress --force 2>&1 > /dev/null - ) - - if [ -e /usr/share/openstack-dashboard/openstack_dashboard/static ] ; then - chown -R horizon:horizon \ - /usr/share/openstack-dashboard/openstack_dashboard/static - fi - - if [ -d /usr/share/openstack-dashboard/openstack_dashboard/locale -a -e /usr/share/openstack-dashboard/manage.py ] ; then - curdir=$(pwd) - cd /usr/share/openstack-dashboard/openstack_dashboard - python ../manage.py compilemessages - cd "${curdir}" - else - echo "Couldn't compile Django l10n strings (.mo files)" - fi - - if [ -d /etc/openstack-dashboard/ ] ; then - chown horizon:horizon /etc/openstack-dashboard/ - fi - - A22_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) - - if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then - # apache 2.4 - . /usr/share/apache2/apache2-maintscript-helper - apache2_invoke enconf $CONF || exit $? - elif [ "$A22_STATE" = "installed" ] || [ "$A22_STATE" = "unpacked" ] ; then - # apache 2.2 - [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$CONF ] && - ln -s ../conf-available/$CONF /etc/apache2/conf.d/$CONF - [ -x /etc/init.d/apache2 ] && invoke-rc.d --quiet apache2 reload - fi - - if [ -d /var/lib/openstack-dashboard ] ; then - # Generated secret storage for single node use - see local_settings.py - # for more details of SECRET_KEY - chmod 0700 /var/lib/openstack-dashboard - if [ -f /etc/openstack-dashboard/secret_key ]; then - mv /etc/openstack-dashboard/secret_key /var/lib/openstack-dashboard - fi - chown -R horizon:horizon /var/lib/openstack-dashboard - fi +pkgos_adduser () { + local VAR_UG_PKG_NAME + VAR_UG_PKG_NAME=${1} + + # Create user and groups if they don't exist + if ! getent group ${VAR_UG_PKG_NAME} > /dev/null 2>&1 ; then + addgroup --quiet --system ${VAR_UG_PKG_NAME} + fi + if ! getent passwd ${VAR_UG_PKG_NAME} > /dev/null 2>&1 ; then + adduser --system \ + --home /var/lib/${VAR_UG_PKG_NAME} \ + --no-create-home \ + --quiet \ + --disabled-password \ + --shell /bin/bash \ + --group ${VAR_UG_PKG_NAME} + fi +} + + +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then + # /etc/apache2/conf.d/dashboard.conf -> /etc/apache2/conf-available/openstack-dashboard.conf + dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf-available/$CONF 2012.1~rc1-0ubuntu1 -- "$@" + + # Transition config to apache 2.4 compatable location. + dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/$CONF /etc/apache2/conf-available/$CONF 1:2013.2~b2-0ubuntu3 -- "$@" + + pkgos_adduser horizon + mkdir -p /var/lib/horizon + chown www-data /var/lib/horizon + + # We need these, since we have symlinks of them in /usr + mkdir -p /var/lib/openstack-dashboard/static/js + mkdir -p /var/lib/openstack-dashboard/static/css + mkdir -p /var/lib/openstack-dashboard/secret-key + chown horizon:horizon /var/lib/openstack-dashboard/static + chown horizon:horizon /var/lib/openstack-dashboard/static/css + chown horizon:horizon /var/lib/openstack-dashboard/static/js + chown horizon:horizon /var/lib/openstack-dashboard/secret-key + chown -R horizon /var/lib/openstack-dashboard/secret-key + chmod 775 /var/lib/openstack-dashboard + + /usr/share/openstack-dashboard/manage.py compress --force + + A22_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + # apache 2.4 + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke enconf $CONF || exit $? + elif [ "$A22_STATE" = "installed" ] || [ "$A22_STATE" = "unpacked" ] ; then + # apache 2.2 + [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$CONF ] && ln -s ../conf-available/$CONF /etc/apache2/conf.d/$CONF + [ -x /etc/init.d/apache2 ] && invoke-rc.d --quiet apache2 reload + fi + + if ! [ -d /var/lib/openstack-dashboard ] ; then + # Generated secret storage for single node use - see local_settings.py + # for more details of SECRET_KEY + mkdir -p /var/lib/openstack-dashboard + chmod 0700 /var/lib/openstack-dashboard + chown -R horizon:horizon /var/lib/openstack-dashboard + fi + if [ -f /etc/openstack-dashboard/secret_key ] && [ ! -f /var/lib/openstack-dashboard/secret_key ] ; then + ln -s /etc/openstack-dashboard/secret_key /var/lib/openstack-dashboard/secret_key + chown horizon:horizon /var/lib/openstack-dashboard/secret_key + fi + chown -R horizon:horizon /var/lib/openstack-dashboard + mkdir -p /usr/lib/python2.7/dist-packages/horizon/static/horizon/lib/font-awesome + ln -s /usr/share/fonts-font-awesome/font /usr/lib/python2.7/dist-packages/horizon/static/horizon/lib/font-awesome/fonts || true +fi + +if [ "$1" = "triggered" ] ; then + /usr/share/openstack-dashboard/manage.py compress --force fi #DEBHELPER# + +exit 0 diff --git a/trusty/debian/openstack-dashboard.postrm b/trusty/debian/openstack-dashboard.postrm index 407ec1b..b63525d 100644 --- a/trusty/debian/openstack-dashboard.postrm +++ b/trusty/debian/openstack-dashboard.postrm @@ -6,39 +6,28 @@ set -e CONF="openstack-dashboard.conf" # /etc/apache2/conf.d/dashboard.conf -> /etc/apache2/conf-available/openstack-dashboard.conf -dpkg-maintscript-helper mv_conffile \ - /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf-available/$CONF \ - 2012.1~rc1-0ubuntu1 -- "$@" +dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf-available/$CONF 2012.1~rc1-0ubuntu1 -- "$@" # Transition config to apache 2.4 compatable location. -dpkg-maintscript-helper mv_conffile \ - /etc/apache2/conf.d/openstack-dashboard.conf \ - /etc/apache2/conf-available/openstack-dashboard.conf \ - 1:2013.2~b2-0ubuntu3 -- "$@" +dpkg-maintscript-helper mv_conffile /etc/apache2/conf.d/openstack-dashboard.conf /etc/apache2/conf-available/openstack-dashboard.conf 1:2013.2~b2-0ubuntu3 -- "$@" if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then - A22_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) - - if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then - # apache 2.4 - . /usr/share/apache2/apache2-maintscript-helper - apache2_invoke disconf $CONF || exit $? - elif [ "$A22_STATE" = "installed" ] || [ "$A22_STATE" = "unpacked" ] ; then - # apache 2.2 - [ -d /etc/apache2/conf.d/ ] && [ -L /etc/apache2/conf.d/$CONF ] && - rm /etc/apache2/conf.d/$CONF - [ -x /etc/init.d/apache2 ] && invoke-rc.d --quiet apache2 reload - fi -fi - -if [ "$1" = "purge" ] ; then - if (which deluser && getent passwd horizon) > /dev/null 2>&1; then - deluser --system --quiet --backup-to /var/lib horizon - fi - if (which delgroup && getent group horizon) > /dev/null 2>&1; then - delgroup --system --quiet horizon - fi + A22_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + # apache 2.4 + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke disconf $CONF || exit $? + elif [ "$A22_STATE" = "installed" ] || [ "$A22_STATE" = "unpacked" ] ; then + # apache 2.2 + [ -d /etc/apache2/conf.d/ ] && [ -L /etc/apache2/conf.d/$CONF ] && + rm /etc/apache2/conf.d/$CONF + [ -x /etc/init.d/apache2 ] && invoke-rc.d --quiet apache2 reload + fi + rm -rf /var/lib/openstack-dashboard/static fi #DEBHELPER# + +exit 0 diff --git a/trusty/debian/openstack-dashboard.triggers b/trusty/debian/openstack-dashboard.triggers new file mode 100644 index 0000000..3bc8167 --- /dev/null +++ b/trusty/debian/openstack-dashboard.triggers @@ -0,0 +1,18 @@ +interest /usr/lib/python2.7/dist-packages/xstatic/pkg/bootstrap_scss/data +interest /usr/lib/python2.7/dist-packages/xstatic/pkg/jasmine/data +interest /usr/share/javascript/angular.js +interest /usr/share/javascript/d3 +interest /usr/share/javascript/jquery +interest /usr/share/javascript/jquery-cookie +interest /usr/share/javascript/jquery-metadata +interest /usr/share/javascript/jquery.quicksearch +interest /usr/share/javascript/jquery-tablesorter +interest /usr/share/javascript/jquery-ui +interest /usr/share/javascript/jsencrypt +interest /usr/share/javascript/qunit +interest /usr/share/javascript/rickshaw +interest /usr/share/javascript/spin.js +interest /usr/share/javascript/underscore +interest /usr/share/twitter-bootstrap/files +interest /usr/share/javascript/term.js +interest /usr/share/javascript/lrDragNDrop diff --git a/trusty/debian/rules b/trusty/debian/rules index 031e8a6..c72ffd1 100755 --- a/trusty/debian/rules +++ b/trusty/debian/rules @@ -22,6 +22,11 @@ override_dh_auto_build: #dh_auto_build override_dh_auto_install: + # Note: upstream advises to use "python setup.py compile_catalog" + # maybe we should do that next time. + chmod +x debian/compile-messages + $(CURDIR)/debian/compile-messages + # install horizon and dashboard python setup.py install --root=$(CURDIR)/debian/tmp --no-compile -O0 --install-layout=deb # install vendorfied xstatic assets @@ -36,6 +41,21 @@ override_dh_auto_install: cp $(CURDIR)/openstack_dashboard/local/local_settings.py.example \ $(CURDIR)/debian/tmp/etc/openstack-dashboard/local_settings.py + + # Fix path of WEBROOT to be /horizon and not just / + sed -i "s#^WEBROOT[ \t]*=.*#WEBROOT = '/horizon'#" $(CURDIR)/debian/tmp/etc/openstack-dashboard/local_settings.py + # Fix path of $webroot to be /horizon and not just / for scss + sed -i 's#^$$webroot: ""#$$webroot: "/horizon/"#' \ + $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss/_variables.scss + # Fix path of secret-key (ie: in /var, as per Debian policy) + sed -i -e 's/os.path.join(LOCAL_PATH,/os.path.join("\/","var","lib","openstack-dashboard","secret-key",/' \ + $(CURDIR)/debian/tmp/etc/openstack-dashboard/local_settings.py + # Activate off-line compress + echo "COMPRESS_OFFLINE=True" >> $(CURDIR)/debian/tmp/etc/openstack-dashboard/local_settings.py + + # Copy the missing angular folder + cp -auxf horizon/static/angular $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/openstack_dashboard/static + cp $(CURDIR)/manage.py \ $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/manage.py ln -fs /etc/openstack-dashboard/local_settings.py \ @@ -43,6 +63,15 @@ override_dh_auto_install: ln -fs /usr/lib/$(PYVER)/dist-packages/horizon/static/horizon \ $(CURDIR)/debian/tmp/usr/share/openstack-dashboard/openstack_dashboard/static/horizon +override_dh_link: + mkdir -p $(CURDIR)/debian/openstack-dashboard/var/lib/openstack-dashboard/static/scss + mv $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss/* $(CURDIR)/debian/openstack-dashboard/var/lib/openstack-dashboard/static/scss + rm -rf $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss + rm -rf $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/js + rm -rf $(CURDIR)/debian/openstack-dashboard/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css + rm -rf $(CURDIR)/debian/openstack-dashboard/usr/share/pyshared/horizon/static/horizon/lib/font-awesome/fonts + dh_link + ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) override_dh_auto_test: # Skip tests @@ -54,4 +83,4 @@ ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS))) python setup.py build_sphinx cp -rf doc/build/html $(CURDIR)/debian/horizon-doc/usr/share/doc/horizon-doc dh_sphinxdoc -O--buildsystem=python_distutils -endif \ No newline at end of file +endif