Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 42 lines (30 sloc) 977 Bytes
#!/usr/bin/env bash
# ``wrap-work`` handles the cleanup of the "work" configuration of DevStack.
# Keep track of the devstack directory
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
# Import common functions
source $GRENADE_DIR/functions
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
# and ``DISTRO``
GetDistro
# Source params
source $GRENADE_DIR/grenaderc
# For debugging
set -o xtrace
cd $WORK_DEVSTACK_DIR
source ./stackrc
# System Cleanup
# ==============
# Rename databases
myauth="-uroot -p$MYSQL_PASSWORD"
for db in glance keystone nova; do
new_db=${db}_${START_RELEASE}
echo "Renaming $db to $new_db"
mysql $myauth -e "DROP DATABASE $new_db"
mysql $myauth -e "CREATE DATABASE $new_db;"
for i in $(mysql -Ns $1 -e "SHOW TABLES" $db);do
mysql $myauth -e "RENAME TABLE $db.$i TO $new_db.$i"
done
mysql $myauth -e "DROP DATABASE $db"
done