#!/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/core_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 mcord
    python ./manage.py makemigrations ceilometer
    python ./manage.py makemigrations onos
    python ./manage.py makemigrations openvpn
    python ./manage.py makemigrations vtr
    python ./manage.py makemigrations vrouter
    python ./manage.py makemigrations vtn
    python ./manage.py makemigrations fabric
    #python ./manage.py makemigrations servcomp

    if [[ -e /opt/xos/xos/xosbuilder_migration_list ]]; then
        cat /opt/xos/xos/xosbuilder_migration_list | while read line; do
            if [[ ! -z "$line" ]]; then
                python ./manage.py makemigrations $line
            fi
        done
    fi
}

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/core_initial_data.json $XOS_DIR/core/fixtures/core_initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/core_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/core_initial_data.json $XOS_DIR/core/fixtures/core_initial_data.json-old
    cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/core_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
