|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# ``upgrade-cloudkitty`` |
| 4 | + |
| 5 | +echo "*********************************************************************" |
| 6 | +echo "Begin $0" |
| 7 | +echo "*********************************************************************" |
| 8 | + |
| 9 | +# Clean up any resources that may be in use |
| 10 | +cleanup() { |
| 11 | + set +o errexit |
| 12 | + |
| 13 | + echo "********************************************************************" |
| 14 | + echo "ERROR: Abort $0" |
| 15 | + echo "********************************************************************" |
| 16 | + |
| 17 | + # Kill ourselves to signal any calling process |
| 18 | + trap 2; kill -2 $$ |
| 19 | +} |
| 20 | + |
| 21 | +trap cleanup SIGHUP SIGINT SIGTERM |
| 22 | + |
| 23 | +# Keep track of the grenade directory |
| 24 | +RUN_DIR=$(cd $(dirname "$0") && pwd) |
| 25 | + |
| 26 | +# Source params |
| 27 | +source $GRENADE_DIR/grenaderc |
| 28 | + |
| 29 | +# Import common functions |
| 30 | +source $GRENADE_DIR/functions |
| 31 | + |
| 32 | +# This script exits on an error so that errors don't compound and you see |
| 33 | +# only the first error that occurred. |
| 34 | +set -o errexit |
| 35 | + |
| 36 | +# Upgrade cloudkitty |
| 37 | +# ================== |
| 38 | + |
| 39 | +# Get functions from current DevStack |
| 40 | +source $TARGET_DEVSTACK_DIR/stackrc |
| 41 | +source $TARGET_DEVSTACK_DIR/lib/apache |
| 42 | +source $TARGET_DEVSTACK_DIR/lib/tls |
| 43 | +source $(dirname $(dirname $BASH_SOURCE))/settings |
| 44 | +source $(dirname $(dirname $BASH_SOURCE))/plugin.sh |
| 45 | + |
| 46 | +# Print the commands being run so that we can see the command that triggers |
| 47 | +# an error. It is also useful for following allowing as the install occurs. |
| 48 | +set -o xtrace |
| 49 | + |
| 50 | +# Save current config files for posterity |
| 51 | +[[ -d $SAVE_DIR/etc.cloudkitty ]] || cp -pr $CLOUDKITTY_CONF_DIR $SAVE_DIR/etc.cloudkitty |
| 52 | + |
| 53 | +# Install the target cloudkitty |
| 54 | +FILES=/tmp |
| 55 | +install_cloudkitty |
| 56 | + |
| 57 | +# calls upgrade-cloudkitty for specific release |
| 58 | +upgrade_project cloudkitty $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH |
| 59 | + |
| 60 | +# Migrate the database |
| 61 | +upgrade_cloudkitty_database || die $LINO "ERROR in database migration" |
| 62 | + |
| 63 | +start_cloudkitty |
| 64 | + |
| 65 | +# Don't succeed unless the services come up |
| 66 | +ensure_services_started ck-api ck-proc |
| 67 | + |
| 68 | +set +o xtrace |
| 69 | +echo "*********************************************************************" |
| 70 | +echo "SUCCESS: End $0" |
| 71 | +echo "*********************************************************************" |
0 commit comments