From 311490786160e82af05c85b420bb17e41da62649 Mon Sep 17 00:00:00 2001 From: Rene Diepstraten Date: Tue, 22 Oct 2019 13:15:21 +0200 Subject: [PATCH] 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. --- scripts/vm/network/security_group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py index 2b81c3f2f45..1cb4a84b525 100755 --- a/scripts/vm/network/security_group.py +++ b/scripts/vm/network/security_group.py @@ -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()