Fixed an issue occasionally causing an empty config for etcd slave nodes
The script which adds new nodes to etcd cluster now does up to 30 attempts and fails (returns a non-zero exit code) if none are successful. A minor performance optimization has been done as well, so no unneeded waits happen when the command is successful and no temporary files are used. Closes-Bug: #1494997 Change-Id: Ic0552f388518c119925da902b64797bbf96f979f
This commit is contained in:
parent
a4f4876340
commit
2da4435439
@ -2,13 +2,15 @@
|
||||
|
||||
# $1 - NAME
|
||||
# $2 - IP
|
||||
count=5
|
||||
done=false
|
||||
count=30
|
||||
|
||||
while [ $count -gt 0 ] && [ "$done" != "true" ]
|
||||
do
|
||||
/opt/bin/etcdctl member add $1 http://$2:7001 > /tmp/out && done="true"
|
||||
((count-- ))
|
||||
sleep 2
|
||||
while [ $count -gt 0 ]; do
|
||||
out=$(/opt/bin/etcdctl member add "$1" "http://$2:7001")
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$out" | grep ETCD_INITIAL_CLUSTER= | cut -f 2 -d '"'
|
||||
exit 0
|
||||
fi
|
||||
((count-- ))
|
||||
sleep 2
|
||||
done
|
||||
cat /tmp/out | grep ETCD_INITIAL_CLUSTER | grep -n 1 | cut -f 2 -d'"'
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user