From 3a7af8e8d6408c95b23ea420e4a065acf0860fe3 Mon Sep 17 00:00:00 2001 From: Gustavo Kawamoto Date: Wed, 19 Apr 2017 09:59:32 -0300 Subject: [PATCH] Subnet ignoring Needed for Cattle support --- elasticsearch/start | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/elasticsearch/start b/elasticsearch/start index 7612c084..b6de6c86 100755 --- a/elasticsearch/start +++ b/elasticsearch/start @@ -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" }