Sean Dague 8ee1af8f3b clean up upgrade scripts
The upgrade scripts have a *ton* of historical cruft in them. This is
a bulk clean up patch that does the following things:

 - ensures we source grenaderc before functions, we need this for
   devstack dir definitions.

 - moves xtraces until after sources to trim down irrelevant output

 - removes as many variables and library sources as possible to ensure
   that we include the minimum possible code in these scripts (for
   sanity and readability).

This skips the neutron upgrade script, much like in devstack, the
neutron code has so many extra variables it's not clear what's really
needed.

Change-Id: Idac9190fd33478a479f7c7dd5cb1be894bb03444
2015-05-07 17:51:44 +00:00

64 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# ``upgrade-ceilometer``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "*********************************************************************"
echo "ERROR: Abort $0"
echo "*********************************************************************"
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM
# Keep track of the grenade directory
RUN_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Upgrade Ceilometer
# ==================
# Get functions from current DevStack
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/ceilometer
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
# install_ceilometer()
stack_install_service ceilometer
# calls upgrade-ceilometer for specific release
upgrade_project ceilometer $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# Migrate the database
$CEILOMETER_BIN_DIR/ceilometer-dbsync || die $LINENO "DB sync error"
# Start Ceilometer
start_ceilometer
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"