#!/bin/bash

if [ -z "$1" ]; then
    echo usage: $0 "[initdb | createdb | dropdb | syncdb | runserver | resetdb | dumpdata]"
    exit
fi

XOS_DIR=/opt/xos
BACKUP_DIR=/opt/xos_backups
DBNAME=xos

DJANGO_17=`python -c "import django; from distutils.version import StrictVersion; print int(StrictVersion(django.get_version()) >= StrictVersion('1.7'))"`

cd $XOS_DIR

function is_ubuntu {
    if ! which lsb_release &> /dev/null; then
        # lsb_release is not installed
        return 1
    fi
    if lsb_release -i | grep -i ubuntu &> /dev/null; then
        return 0
    fi
    return 2
}

function ensure_postgres_running {
    # "sudo -u postgres pg_ctl -D /var/lib/postgres/data status" doesn't work
    # right on Vicci, so let's try to detect it by seeing if the port is
    # being listened on

    netstat -nl | grep -i ":5432 " > /dev/null
    if [[ $? == 0 ]]; then
        echo "Postgres is already running"
        return
    fi

    # note that initdb isn't needed in Ubuntu distributions, and calling it
    # will throw spurious error messages
    if ! is_ubuntu; then
        service postgresql initdb
    fi
    service postgresql start

    netstat -nl | grep -i ":5432 " > /dev/null
    if [[ $? != 0 ]]; then
        # it's still not running...
	# this is intended for Vicci where some D-Bus issue is
        # preventing systemctl from working properly.
        echo "Trying fallback mechanism to start Postgres"
        sudo -u postgres initdb -D /var/lib/pgsql/data/
        sudo -u postgres pg_ctl -D /var/lib/pgsql/data -l logfile start
    fi

}

function wait_postgres {
    sudo -u postgres psql -c '\q'
    while [[ "$?" != "0" ]]; do
        echo Waiting for postgres to start
        sleep 1
        sudo -u postgres psql -c '\q'
    done 
}

function db_exists {
   sudo -u postgres psql $DBNAME -c '\q' 2>/dev/null    
   return $?
} 

function createdb {
    wait_postgres
    echo "Creating XOS database..."
    sudo -u postgres createdb $DBNAME
}
function dropdb {
    echo "Dropping XOS database..."
    sudo -u postgres dropdb $DBNAME
}
function syncdb {
    echo "Syncing XOS services..."
    python $XOS_DIR/manage.py syncdb --noinput
    if [[ $DJANGO_17 ]]; then
        echo "Loading initial data from fixture..."
        python $XOS_DIR/manage.py --noobserver --nomodelpolicy loaddata $XOS_DIR/core/fixtures/initial_data.json
    fi
}
function evolvedb {
    echo "Evolving XOS services..."
    python $XOS_DIR/manage.py evolve --hint --execute --noinput
}
function migratedb {
    echo "Migrating XOS services..."
    python $XOS_DIR/manage.py migrate
}
function stopserver {
    echo "Stopping any running XOS Service(s)"
    pkill -f "python.*runserver"
}
function runserver {
    ensure_postgres_running
    PUBLIC_HOSTNAME="0.0.0.0"
    echo "Starting XOS Service on $PUBLIC_HOSTNAME:8000"
    python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure&
}

function dumpdata {
    mkdir -p $BACKUP_DIR
    FN="$BACKUP_DIR/dumpdata-`date +%Y-%m-%d_%H:%M:%S`.json"
    echo "Saving data to $FN"
    python manage.py dumpdata core hpc syndicate_storage requestrouter -a --indent 4 > $FN
    if [[ ! -f $FN ]]; then
        echo "FAILED to create $FN"
        exit
    fi
    SIZE=$(du -k "$FN" | cut -f 1)
    if [[ $SIZE -lt 9 ]]; then
        echo "Dumpdata was empty. Deleting and aborting"
        rm $FN
        exit
    fi
    rm -f $BACKUP_DIR/dumpdata-latest.json
    ln -s $FN $BACKUP_DIR/dumpdata-latest.json
}

function genkeys {
    mkdir -p public_keys
    mkdir -p private_keys
    echo "Generating keys"
	keyczart create --location=private_keys --name="OpenCloud" --purpose=crypt --asymmetric=rsa
	keyczart addkey --location=private_keys --status=primary --size=1024
	keyczart pubkey --location=private_keys --destination=public_keys
    if [[ ! -f public_keys/1 ]]; then
        echo "FAILED to create keys"
        exit
    fi
}

function makemigrations {
    rm -rf /opt/xos/*/migrations /opt/xos/services/*/migrations
    python ./manage.py makemigrations core
    python ./manage.py makemigrations hpc
    python ./manage.py makemigrations requestrouter
    python ./manage.py makemigrations syndicate_storage
    python ./manage.py makemigrations cord
    python ./manage.py makemigrations ceilometer
    python ./manage.py makemigrations helloworldservice_complete
    python ./manage.py makemigrations onos
    #python ./manage.py makemigrations servcomp
}

function remigrate {
    if db_exists; then
        dropdb
    fi
    makemigrations
}

COMMAND=$1

if [ "$COMMAND" = "initdb" ]; then
    stopserver
    ensure_postgres_running
    createdb
    syncdb
fi
if [ "$COMMAND" = "repairdb" ]; then
    stopserver
    ensure_postgres_running
    dumpdata
    # TODO: This is where we could run migration scripts to upgrade the
    #   dumped data to the new models.
    mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "restoredb" ]; then
    if [[ ! -f $BACKUP_DIR/dumpdata-latest.json ]]; then
       echo There is no dumpdata to restore
       exit
    fi
    stopserver
    ensure_postgres_running
    mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
    stopserver
    ensure_postgres_running
    if [[ $DJANGO_17 ]]; then
        migratedb
    else
        evolvedb
    fi
fi
if [ "$COMMAND" = "resetdb" ]; then
    stopserver
    ensure_postgres_running
    dropdb
    createdb
    syncdb
fi
if [ "$COMMAND" = "syncdb" ]; then
    stopserver
    syncdb
fi
if [ "$COMMAND" = "runserver" ]; then
    stopserver
    runserver
fi
if [ "$COMMAND" = "stopserver" ]; then
    stopserver
fi
if [ "$COMMAND" = "dumpdata" ]; then
    dumpdata
fi
if [ "$COMMAND" = "genkeys" ]; then
    genkeys
fi
if [ "$COMMAND" = "generateapi" ]; then
   python apigen/modelgen apigen/api.template.py > xos/xosapi.py
fi
if [ "$COMMAND" = "remigrate" ]; then
   ensure_postgres_running
   remigrate
   createdb
   syncdb
fi
if [ "$COMMAND" = "makemigrations" ]; then
   makemigrations
   syncdb
fi
