switch to single pass script
This commit is contained in:
parent
aec8fa4eb5
commit
75a3765303
1 changed files with 140 additions and 163 deletions
27
stack.sh
27
stack.sh
|
@ -10,7 +10,6 @@ set -o xtrace
|
||||||
|
|
||||||
DIR=`pwd`
|
DIR=`pwd`
|
||||||
DEST=/opt
|
DEST=/opt
|
||||||
CMD=$1
|
|
||||||
|
|
||||||
# Set the destination directories for openstack projects
|
# Set the destination directories for openstack projects
|
||||||
NOVA_DIR=$DEST/nova
|
NOVA_DIR=$DEST/nova
|
||||||
|
@ -41,10 +40,8 @@ NET_MAN=${NET_MAN:-VlanManager}
|
||||||
# TODO: switch to mysql for all services
|
# TODO: switch to mysql for all services
|
||||||
SQL_CONN=sqlite:///$NOVA_DIR/nova.sqlite
|
SQL_CONN=sqlite:///$NOVA_DIR/nova.sqlite
|
||||||
|
|
||||||
# FIXME: commands should be: stack.sh all or list of services to install/run
|
# FIXME: commands should be: stack.sh should allow specifying a subset of services
|
||||||
|
|
||||||
# You should only have to run this once
|
|
||||||
if [ "$CMD" == "install" ]; then
|
|
||||||
# install apt requirements
|
# install apt requirements
|
||||||
apt-get install -y -q `cat $DIR/apts/* | cut -d\# -f1`
|
apt-get install -y -q `cat $DIR/apts/* | cut -d\# -f1`
|
||||||
|
|
||||||
|
@ -105,7 +102,7 @@ if [ "$CMD" == "install" ]; then
|
||||||
cp local/local_settings.py.example local/local_settings.py
|
cp local/local_settings.py.example local/local_settings.py
|
||||||
dashboard/manage.py syncdb
|
dashboard/manage.py syncdb
|
||||||
|
|
||||||
# # Setup Apache
|
# ## Setup Apache
|
||||||
# create an empty directory to use as our
|
# create an empty directory to use as our
|
||||||
mkdir $DASH_DIR/.blackhole
|
mkdir $DASH_DIR/.blackhole
|
||||||
# FIXME(ja): can't figure out how to make $DASH_DIR work in sed, also install to available/a2e it
|
# FIXME(ja): can't figure out how to make $DASH_DIR work in sed, also install to available/a2e it
|
||||||
|
@ -127,8 +124,6 @@ if [ "$CMD" == "install" ]; then
|
||||||
cp $DIR/files/screenrc ~/.screenrc
|
cp $DIR/files/screenrc ~/.screenrc
|
||||||
|
|
||||||
# TODO: update current user to allow sudo for all commands in files/sudo/*
|
# TODO: update current user to allow sudo for all commands in files/sudo/*
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
NL=`echo -ne '\015'`
|
NL=`echo -ne '\015'`
|
||||||
|
|
||||||
|
@ -143,8 +138,6 @@ function add_nova_flag {
|
||||||
echo "$1" >> $NOVA_DIR/bin/nova.conf
|
echo "$1" >> $NOVA_DIR/bin/nova.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$CMD" == "run" ] || [ "$CMD" == "run_detached" ]; then
|
|
||||||
|
|
||||||
# (re)create nova.conf
|
# (re)create nova.conf
|
||||||
rm -f $NOVA_DIR/bin/nova.conf
|
rm -f $NOVA_DIR/bin/nova.conf
|
||||||
add_nova_flag "--verbose"
|
add_nova_flag "--verbose"
|
||||||
|
@ -213,19 +206,3 @@ if [ "$CMD" == "run" ] || [ "$CMD" == "run_detached" ]; then
|
||||||
rm -rf $DIR/images/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]
|
rm -rf $DIR/images/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]
|
||||||
$NOVA_DIR/bin/nova-manage image convert $DIR/images
|
$NOVA_DIR/bin/nova-manage image convert $DIR/images
|
||||||
|
|
||||||
if [ "$CMD" != "run_detached" ]; then
|
|
||||||
screen -S nova -x
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CMD" == "run" ] || [ "$CMD" == "terminate" ]; then
|
|
||||||
virsh list | grep i- | awk '{print $1}' | xargs -n1 virsh destroy
|
|
||||||
$NOVA_DIR/tools/clean-vlans
|
|
||||||
echo "FIXME: clean networks?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CMD" == "run" ] || [ "$CMD" == "clean" ]; then
|
|
||||||
screen -S nova -X quit
|
|
||||||
rm -f *.pid*
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue