-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathetcd-up.sh
executable file
·42 lines (32 loc) · 1018 Bytes
/
etcd-up.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
#!/usr/bin/env bash
# Bring up a etcd cluster.
set -o errexit
set -o nounset
set -o pipefail
ETCD_ROOT=$(dirname "${BASH_SOURCE}")
if [ $# -le 0 ];then
echo -e "Environment para should be set" >&2
exit 1
fi
envfile=$1
if [ -f "${ETCD_ROOT}/env/${envfile}.sh" ]; then
source "${ETCD_ROOT}/env/${envfile}.sh"
else
echo -e "Canot find Environment file ${ETCD_ROOT}/env/${envfile}.sh " >&2
exit 1
fi
source ${ETCD_ROOT}/utils/etcd-util.sh
source ${ETCD_ROOT}/utils/common.sh
echo -e "${color_green}... calling verify-prereqs${color_norm}" >&2
verify-prereqs
echo -e "${color_green}... calling verify-etcd-binaries${color_norm}" >&2
verify-etcd-binaries
echo -e "${color_green}... calling etcd-up${color_norm}" >&2
etcd-up ${envfile}
echo -e "${color_green}... etcd-up done${color_norm}" >&2
echo -e "${color_green}... calling validate-cluster${color_norm}" >&2
# Override errexit
(validate-cluster) && validate_result="$?" || validate_result="$?"
if [[ "${validate_result}" == "1" ]]; then
exit 1
fi