
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
17 lines
264 B
Bash
17 lines
264 B
Bash
#!/bin/bash
|
|
|
|
# $1 - NAME
|
|
# $2 - IP
|
|
count=30
|
|
|
|
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
|
|
exit 1
|