Fix the updated INSTALLER_TYPE variable in scripts
[releng.git] / jjb / fuel / fuel-lab-reconfig.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 # check to see if ucs login info file exists
7 if [ -e ~/.ssh/ucs_creds ];then
8     source ~/.ssh/ucs_creds
9 else
10     echo "Unable to find UCS credentials for LF lab reconfiguration...Exiting"
11     exit 1
12 fi
13
14 # clone releng
15 echo "Cloning releng repo..."
16 if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/releng; then
17     echo "Unable to clone releng repo...Exiting"
18     exit 1
19 fi
20
21 # log info to console
22 echo "Starting the lab reconfiguration for $INSTALLER_TYPE..."
23 echo "--------------------------------------------------------"
24 echo
25
26 # create venv
27 $WORKSPACE/releng/utils/lab-reconfiguration/create_venv.sh
28
29 # disable nounset because 'activate' script contains unbound variable(s)
30 set +o nounset
31 # enter venv
32 source $WORKSPACE/releng/utils/lab-reconfiguration/venv/bin/activate
33 # set nounset back again
34 set -o nounset
35
36 # verify we are in venv
37 if [[ ! $(which python | grep venv) ]]; then
38     echo "Unable to activate venv...Exiting"
39     exit 1
40 fi
41
42 python $WORKSPACE/releng/utils/lab-reconfiguration/reconfigUcsNet.py -i $ucs_host -u $ucs_user -p $ucs_password -f $WORKSPACE/releng/utils/lab-reconfiguration/fuel.yaml
43
44 # while undergoing reboot
45 sleep 30
46
47 # check to see if slave is back up
48 ping_counter=0
49 ping_flag=0
50 while [ "$ping_counter" -lt 20 ]; do
51     if [[ $(ping -c 5 172.30.10.72) ]]; then
52         ping_flag=1
53         break
54     fi
55     ((ping_counter++))
56     sleep 10
57 done
58
59 if [ "$ping_flag" -eq 1 ]; then
60     echo "Slave is pingable, now wait 180 seconds for services to start"
61     sleep 180
62 else
63     echo "Slave did not come back up after reboot: please check opnfv-jump-2"
64     exit 1
65 fi
66
67 set +o nounset
68 deactivate
69
70 echo
71 echo "--------------------------------------------------------"
72 echo "Done!"