Merge pull request #141 from gkawamoto/master

Subnet ignoring
This commit is contained in:
Geoff Bourne 2017-04-19 22:10:23 -05:00 committed by GitHub
commit 8a04a9f72e

View file

@ -20,7 +20,18 @@ discoverIpFromLink() {
}
discoverAllGlobalIps() {
ips=`ipaddr show scope global|awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; addrs[length(addrs)] = $2 } } END { for (i in addrs) { if (i>0) printf "," ; printf addrs[i] } }'`
if [ ${#IGNORE_NETWORK} -eq 0 ]
then
IGNORE_NETWORK='999.999.999.999'
fi
printf "Finding IPs"
while [ ${#ips} -eq 0 ]
do
printf "."
ips=`ipaddr show scope global| grep -v "inet ${IGNORE_NETWORK}" | awk '$1 == "inet" { if (!match($2,"/32")) { gsub("/.*","",$2) ; addrs[length(addrs)] = $2 } } END { for (i in addrs) { if (i>0) printf "," ; printf addrs[i] } }'`
sleep 1
done
echo " found! $ips"
OPTS="$OPTS -E network.host=$ips"
}