Browse code

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

Mikhail S Medvedev authored on 2014/11/19 03:11:26
Showing 1 changed files
... ...
@@ -142,8 +142,16 @@ function init_horizon {
142 142
     # and run_process
143 143
     sudo rm -f /var/log/$APACHE_NAME/horizon_*
144 144
 
145
-    DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py collectstatic --noinput
146
-    DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py compress --force
145
+    # Setup alias for django-admin which could be different depending on distro
146
+    local django_admin
147
+    if type -p django-admin > /dev/null; then
148
+        django_admin=django-admin
149
+    else
150
+        django_admin=django-admin.py
151
+    fi
152
+
153
+    DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin collectstatic --noinput
154
+    DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin compress --force
147 155
 
148 156
 }
149 157