X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=planetstack%2Fscripts%2Fopencloud;h=54852b96076dfb67a9763a50ad0ed9f610a410c0;hb=b3a3381d3b4c82a806fc85d53ad6ae8a460f68ba;hp=901ad80a3aacf4952ec8c0e911abedc0bb4a1e95;hpb=c9460f7a95b275ca482e57f3d6bb2a9780a4976d;p=plstackapi.git diff --git a/planetstack/scripts/opencloud b/planetstack/scripts/opencloud old mode 100755 new mode 100644 index 901ad80..54852b9 --- a/planetstack/scripts/opencloud +++ b/planetstack/scripts/opencloud @@ -7,6 +7,8 @@ fi BACKUP_DIR=/opt/planetstack_backups +DJANGO_17=`python -c "import django; from distutils.version import StrictVersion; print int(StrictVersion(django.get_version()) >= StrictVersion('1.7'))"` + cd /opt/planetstack function ensure_postgres_running { @@ -44,6 +46,10 @@ function dropdb { function syncdb { echo "Syncing OpenCloud services..." python /opt/planetstack/manage.py syncdb --noinput + if [[ $DJANGO_17 ]]; then + echo "Loading initial data from fixture..." + python /opt/planetstack/manage.py --noobserver --nomodelpolicy loaddata /opt/planetstack/core/fixtures/initial_data.json + fi } function evolvedb { echo "Evolving OpenCloud services..." @@ -128,15 +134,14 @@ if [ "$COMMAND" = "restoredb" ]; then createdb syncdb fi -if [ "$COMMAND" = "evolvedb" ]; then - stopserver - ensure_postgres_running - evolvedb -fi -if [ "$COMMAND" = "migratedb" ]; then +if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then stopserver ensure_postgres_running - migratedb + if [[ $DJANGO_17 ]]; then + migratedb + else + evolvedb + fi fi if [ "$COMMAND" = "resetdb" ]; then stopserver