Allow packstack to detect linux sub-interfaces properly

Change-Id: Iebc764c1bf9fa6639cb81f0aa9d45eab4c176424
This commit is contained in:
Sean P. Kane
2013-09-25 16:38:02 -07:00
parent 00d78114eb
commit 645591bcdf

View File

@@ -76,8 +76,10 @@ def force_ip(host, allow_localhost=False):
def device_from_ip(ip):
server = ScriptRunner()
server.append("DEVICE=$(ip address show to %s | head -n 1 |"
" sed -e 's/.*: \(.*\):.*/\\1/g')" % ip)
server.append("DEVICE=($(ip -o address show to %s | cut -f 2 -d ' '))"
% ip)
# Ensure that the IP is only assigned to one interface
server.append("if [ ! -z ${DISPLAY[1]} ]; then false; fi")
# Test device, raises an exception if it doesn't exist
server.append("ip link show \"$DEVICE\" > /dev/null")
server.append("echo $DEVICE")