-
Notifications
You must be signed in to change notification settings - Fork 32
/
upgrade.sh
executable file
·92 lines (73 loc) · 3.04 KB
/
upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# ``upgrade-vitrage``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "*********************************************************************"
echo "ERROR: Abort $0" >&2
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 Vitrage
# ===============
# Locate vitrage devstack plugin, the directory above the
# grenade plugin.
VITRAGE_DEVSTACK_DIR=$(dirname $(dirname $0))
VITRAGE_DIR=$(dirname $(dirname $0))/../../vitrage
VITRAGE_CONF_DIR=/etc/vitrage
VITRAGE_CONF=$VITRAGE_CONF_DIR/vitrage.conf
# Duplicate some setup bits from target DevStack
source $TARGET_DEVSTACK_DIR/functions
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/tls
source $TARGET_DEVSTACK_DIR/lib/stack
source $TARGET_DEVSTACK_DIR/lib/apache
source $TARGET_DEVSTACK_DIR/lib/rpc_backend
# 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
# Save current config files for posterity
[[ -d $SAVE_DIR/etc.vitrage ]] || cp -pr $VITRAGE_CONF_DIR $SAVE_DIR/etc.vitrage
# Install the target vitrage
source $VITRAGE_DEVSTACK_DIR/plugin.sh stack install
# calls upgrade-vitrage for specific release
upgrade_project vitrage $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# Simulate init_vitrage()
VITRAGE_BIN_DIR=$(dirname $(which vitrage-dbsync))
$VITRAGE_BIN_DIR/vitrage-dbsync --config-file $VITRAGE_CONF || die $LINENO "DB sync error"
# Start Vitrage
start_vitrage
# Don't succeed unless the services come up
# Truncating some service names to 11 characters
ensure_services_started vitrage-api vitrage-graph vitrage-notifier vitrage-ml vitrage-persistor vitrage-snmp-parsing
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"