security_group: Add `head -1` to `get_bridge_physdev` (#3648)

We've encountered a corner case where bridge -o link show returned two lines per bridge instead of one. get_bridge_physdev in security_group.py returned bond0.701\nbond0.701.
Although this may very well be something on the hypervisor, we should limit the lines returned.
I therefore added a mere | head -1 to the function.
This commit is contained in:
Rene Diepstraten 2019-10-22 13:15:21 +02:00 committed by Rohit Yadav
parent cc27095554
commit 3114907861
1 changed files with 1 additions and 1 deletions

View File

@ -149,7 +149,7 @@ def split_ips_by_family(ips):
def get_bridge_physdev(brname):
physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}'" % brname)
physdev = execute("bridge -o link show | awk '/master %s / && !/^[0-9]+: vnet/ {print $2}' | head -1" % brname)
return physdev.strip()