Deal with different django-admin executables

After the recent patch [1] the devstack is broken for Fedora 20 with
the error "django-admin.py: command not found" during horizon setup.

This is due to differences in how django currently packaged for Fedora,
where we should use "django-admin", without the .py

This patch sets up executable alias by checking if "django-admin"
exists, and falling back on "django-admin.py".

[1] https://review.openstack.org/#/c/120940/

Change-Id: I2b6de25fe32446edbdc0418674fea8579ec739d9
This commit is contained in:
Mikhail S Medvedev 2014-11-18 12:11:26 -06:00
parent 8012a9654c
commit 088e66028c

View File

@ -142,8 +142,16 @@ function init_horizon {
# and run_process
sudo rm -f /var/log/$APACHE_NAME/horizon_*
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py collectstatic --noinput
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py compress --force
# Setup alias for django-admin which could be different depending on distro
local django_admin
if type -p django-admin > /dev/null; then
django_admin=django-admin
else
django_admin=django-admin.py
fi
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin collectstatic --noinput
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin compress --force
}