summaryrefslogtreecommitdiffstats
path: root/jjb/fuel/fuel-lab-reconfig.sh
blob: a79bc2c5111379ca66ef59b175e0c22997deb279 (plain)
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
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail

# check to see if ucs login info file exists
if [ -e ~/.ssh/ucs_creds ];then
    source ~/.ssh/ucs_creds
else
    echo "Unable to find UCS credentials for LF lab reconfiguration...Exiting"
    exit 1
fi

# clone releng
echo "Cloning releng repo..."
if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/releng; then
    echo "Unable to clone releng repo...Exiting"
    exit 1
fi

# log info to console
echo "Starting the lab reconfiguration for $INSTALLER..."
echo "--------------------------------------------------------"
echo

# create venv
$WORKSPACE/releng/utils/lab-reconfiguration/create_venv.sh

# disable nounset because 'activate' script contains unbound variable(s)
set +o nounset
# enter venv
source $WORKSPACE/releng/utils/lab-reconfiguration/venv/bin/activate
# set nounset back again
set -o nounset

# verify we are in venv
if [[ ! $(which python | grep venv) ]]; then
    echo "Unable to activate venv...Exiting"
    exit 1
fi

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

# while undergoing reboot
sleep 30

# check to see if slave is back up
ping_counter=0
ping_flag=0
while [ "$ping_counter" -lt 20 ]; do
    if [[ $(ping -c 5 172.30.10.72) ]]; then
        ping_flag=1
        break
    fi
    ((ping_counter++))
    sleep 10
done

if [ "$ping_flag" -eq 1 ]; then
    echo "Slave is pingable, now wait 180 seconds for services to start"
    sleep 180
else
    echo "Slave did not come back up after reboot: please check opnfv-jump-2"
    exit 1
fi

set +o nounset
deactivate

echo
echo "--------------------------------------------------------"
echo "Done!"