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 02:17:05 UTC

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

Updated Branches:
  refs/heads/4.0 7abf11780 -> 0e34bcc77


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/0e34bcc7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/0e34bcc7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/0e34bcc7

Branch: refs/heads/4.0
Commit: 0e34bcc7778e7920d61321e4e6f88061bca94331
Parents: d42f3df
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 17:16:35 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/0e34bcc7/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-'] ]: