You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/14 00:28:51 UTC

[2/2] git commit: CLOUDSTACK-591: Fix execute and string processing logic for reboot_vm in security_group

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 <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6f29317a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6f29317a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6f29317a

Branch: refs/heads/master
Commit: 6f29317a8492008d37c7eb0770f0cee650c14c40
Parents: 1ae2d72
Author: Rohit Yadav <bh...@apache.org>
Authored: Thu Dec 13 15:26:05 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Thu Dec 13 15:28:30 2012 -0800

----------------------------------------------------------------------
 scripts/vm/network/security_group.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6f29317a/scripts/vm/network/security_group.py
----------------------------------------------------------------------
diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py
index 534f384..dcb01a7 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-'] ]: