Use hostname -I in ipdetect script 25/46125/2
authorVratko Polak <vrpolak@cisco.com>
Fri, 23 Sep 2016 11:50:38 +0000 (13:50 +0200)
committerLuis Gomez <ecelgp@gmail.com>
Fri, 4 Nov 2016 19:31:32 +0000 (19:31 +0000)
Change-Id: I0967778137d94aadf3989076ccea9374b18ed1ab
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
distribution-karaf/src/main/assembly/bin/configure-cluster-ipdetect.sh

index d201615302aeb522e5b6dd5950f1eec671cc9325..7b97ef967da8789b454c939b4c30de36878601bb 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/bash
 #
 # Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
+# Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
 #
 # This program and the accompanying materials are made available under the
 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -138,14 +139,12 @@ function get_index ()
 
 function get_local_ip_addresses
 {
-    # Get the local node's IP addresses
-    LOCAL_IP_STRING=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
-
+    # Get the local node's IP addresses as list
     LOCAL_IPS=()
-    while read -r line; do
-        LOCAL_IPS+=("$line")
-    done <<< "$LOCAL_IP_STRING"
-
+    for IP in `hostname -I`
+    do
+        LOCAL_IPS+=("$IP")
+    done
     echo ${LOCAL_IPS[@]}
 }
 
@@ -246,7 +245,7 @@ EOF
  ERROR: Cluster configurations files not found. Please\
  configure clustering feature.
 EOF
-            exit -1
+            exit 1
         fi
     fi
 }