From 0e34bcc7778e7920d61321e4e6f88061bca94331 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 13 Dec 2012 15:26:05 -0800 Subject: [PATCH] CLOUDSTACK-591: Fix execute and string processing logic for reboot_vm in security_group - Since we're always getting the first from the list, use head -1 to get the first of the results instead of processing again - Remove unecessay pop (why was it even there) Signed-off-by: Rohit Yadav --- scripts/vm/network/security_group.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py index 534f384f3d3..dcb01a7604b 100755 --- a/scripts/vm/network/security_group.py +++ b/scripts/vm/network/security_group.py @@ -421,12 +421,11 @@ def network_rules_for_rebooted_vm(vmName): delete_rules_for_vm_in_bridge_firewall_chain(vm_name) - brName = execute("iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' |awk '{print $9}'").split("\n") - if brName is None: + brName = execute("iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' |awk '{print $9}' | head -1").strip() + if brName is None or brName is "": brName = "cloudbr0" else: - brName.pop() - brName = re.sub("^BF-", "", brName[0]) + brName = re.sub("^BF-", "", brName) if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-'] ]: