run migrate for django 1.7 or evolve for django 1.5
authorScott Baker <smbaker@gmail.com>
Thu, 18 Sep 2014 05:19:54 +0000 (22:19 -0700)
committerScott Baker <smbaker@gmail.com>
Thu, 18 Sep 2014 05:19:54 +0000 (22:19 -0700)
opencloud.spec
planetstack/scripts/opencloud

index 4d72a55..5831006 100644 (file)
@@ -1,7 +1,7 @@
 Summary: OpenCloud core services
 Name: opencloud
-Version: 1.0.25
-Release: 8
+Version: 1.0.26
+Release: 7
 License: GPL+
 Group: Development/Tools
 Source0: %{_tmppath}/%{name}-%{version}.tar.gz
@@ -29,7 +29,7 @@ requires: GeoIP
 # Empty section.
 
 %pre
-#pip-python install django==1.5
+pip-python install django==1.7
 pip-python install djangorestframework
 pip-python install markdown  # Markdown support for the browseable API.
 pip-python install pyyaml    # YAML content-type support.
@@ -119,10 +119,9 @@ if [ "$1" == 1 ] ; then
     echo "NEW INSTALL - initializing database"
     /opt/planetstack/scripts/opencloud initdb
 else
-    echo "UPGRADE - doing evolution"
+    # scripts/opencloud will choose evolve or migrate depending on django version
+    echo "UPGRADE - doing evolution/migration"
     /opt/planetstack/scripts/opencloud evolvedb
-    #echo "UPGRADE - doing migration"    
-    #/opt/planetstack/scripts/opencloud migratedb
 fi
 
 # start the server
index ff6eefc..b307e66 100755 (executable)
@@ -134,15 +134,14 @@ if [ "$COMMAND" = "restoredb" ]; then
     createdb
     syncdb
 fi
-if [ "$COMMAND" = "evolvedb" ]; then
+if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
     stopserver
     ensure_postgres_running
-    evolvedb
-fi
-if [ "$COMMAND" = "migratedb" ]; then
-    stopserver
-    ensure_postgres_running
-    migratedb
+    if [[ $DJANGO_17 ]]; then
+        migratedb
+    else
+        evolvedb
+    fi
 fi
 if [ "$COMMAND" = "resetdb" ]; then
     stopserver