-
Notifications
You must be signed in to change notification settings - Fork 0
/
contrail_provision.sh
executable file
·47 lines (39 loc) · 1.49 KB
/
contrail_provision.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
#!/usr/bin/env bash
deploy_contrail_function () {
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export PYTHONPATH=$PYTHONPATH:$DIR
if [ `whoami` != "root" ]; then
echo "must run as root, try \"sudo su\" and re-run"
exit -1
fi
#log file
path_to_log_file=$DIR/logs/$1
source $DIR/.pockit/bin/activate
echo
echo "************************************************"
echo "Re-imaging the cluster and provisioning contrail"
echo
echo "This may take a while............................"
echo
echo "************************************************"
python -u $DIR/contrail/sk_contrail.py
if [ $? -eq 1 ]; then
echo
echo "======================================================="
echo "Either re-image or provisioning contrail encountered errors"
echo "Please check log file at $path_to_log_file for errors"
echo "======================================================="
exit 1
else
echo
echo "**********************************************************"
echo "Re-imaging and provisoning contrail successfully completed,
proceed to deploy vMX on server2 by doing ./vmx_provision.sh"
echo
echo "**********************************************************"
exit 0
fi
}
log_file_name="contrail_provision_log"
new_log_file="$log_file_name-$(date "+%Y_%m_%d_%H_%M_%S").txt"
deploy_contrail_function $new_log_file 2>&1 | tee -a logs/$new_log_file