Skip to content

Commit 0e34bcc

Browse files
committed
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 <bhaisaab@apache.org>
1 parent d42f3df commit 0e34bcc

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

scripts/vm/network/security_group.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,11 @@ def network_rules_for_rebooted_vm(vmName):
421421

422422
delete_rules_for_vm_in_bridge_firewall_chain(vm_name)
423423

424-
brName = execute("iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' |awk '{print $9}'").split("\n")
425-
if brName is None:
424+
brName = execute("iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' |awk '{print $9}' | head -1").strip()
425+
if brName is None or brName is "":
426426
brName = "cloudbr0"
427427
else:
428-
brName.pop()
429-
brName = re.sub("^BF-", "", brName[0])
428+
brName = re.sub("^BF-", "", brName)
430429

431430
if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-'] ]:
432431

0 commit comments

Comments
 (0)