Browse code

Merge "Use ip instead of ifconfig. Should work on F16, F17 and Debian based systesm."

Jenkins authored on 2012/07/03 15:21:36
Showing 1 changed files
... ...
@@ -298,7 +298,7 @@ SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler}
298 298
 HOST_IP_IFACE=${HOST_IP_IFACE:-eth0}
299 299
 # Use the eth0 IP unless an explicit is set by ``HOST_IP`` environment variable
300 300
 if [ -z "$HOST_IP" -o "$HOST_IP" == "dhcp" ]; then
301
-    HOST_IP=`LC_ALL=C /sbin/ifconfig ${HOST_IP_IFACE} | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
301
+    HOST_IP=`LC_ALL=C ip -f inet addr show ${HOST_IP_IFACE} | awk '/inet/ {split($2,parts,"/");  print parts[1]}' | head -n1`
302 302
     if [ "$HOST_IP" = "" ]; then
303 303
         echo "Could not determine host ip address."
304 304
         echo "Either localrc specified dhcp on ${HOST_IP_IFACE} or defaulted to eth0"