/
build.sh
executable file
·69 lines (53 loc) · 1.21 KB
/
build.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
#!/bin/bash
: ${VAGRANT_CONFIG_FILE:=configs/2-controllers-1-compute.yaml}
export VAGRANT_CONFIG_FILE
: ${PROPOSALS_YAML:=/root/HA-cloud.yaml}
here=$(cd `dirname $0` && pwd)
source $here/../lib/common.sh
vagrant_dir=$(cd $here/../../vagrant && pwd)
usage () {
# Call as: usage [EXITCODE] [USAGE MESSAGE]
exit_code=1
if [[ "$1" == [0-9] ]]; then
exit_code="$1"
shift
fi
if [ -n "$1" ]; then
echo >&2 "$*"
echo
fi
me=`basename $0`
cat <<EOF >&2
Usage: $me [options] HYPERVISOR
Options:
-h, --help Show this help and exit
Hypervisor can be 'kvm' or 'virtualbox'.
EOF
exit "$exit_code"
}
parse_args () {
if [ ${#ARGV[@]} != 1 ]; then
usage
fi
hypervisor="${ARGV[0]}"
}
main () {
parse_opts "$@"
parse_args
check_vagrant_config
check_hypervisor
use_bundler_with_kvm
if ! vagrant up --no-parallel; then
die "vagrant up failed; aborting"
fi
vagrant_ssh_config
setup_node_aliases
setup_node_sh_vars
switch_to_kvm_if_required
batch_build_proposals "$PROPOSALS_YAML"
cat <<'EOF'
Success!
A highly-available OpenStack cloud has been built. You can now test failover.
EOF
}
main "$@"