You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/07/12 11:10:43 UTC

git commit: updated refs/heads/master to 67bcce7

Updated Branches:
  refs/heads/master b3fd25d45 -> 67bcce71f


Security Group: Use awk to do matching and printing instead of using grep + awk.

Makes it a bit shorter code wise


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

Branch: refs/heads/master
Commit: 67bcce71f7fa42a7b9bf9f868a274e0a0da28b0f
Parents: b3fd25d
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Fri Jul 12 11:09:41 2013 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Fri Jul 12 11:09:41 2013 +0200

----------------------------------------------------------------------
 scripts/vm/network/security_group.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67bcce71/scripts/vm/network/security_group.py
----------------------------------------------------------------------
diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py
index 0ac8b74..10610f0 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -590,7 +590,7 @@ def network_rules_for_rebooted_vm(vmName):
     return True
 
 def get_rule_logs_for_vms():
-    cmd = "virsh list|grep running |awk '{print $2}'"
+    cmd = "virsh list|awk '/running/ {print $2}'"
     vms = bash("-c", cmd).stdout.split("\n")
     
     result = []
@@ -621,7 +621,7 @@ def cleanup_rules():
             if 1 in [ chain.startswith(c) for c in ['r-', 'i-', 's-', 'v-'] ]:
                 vm_name = chain
                 
-                cmd = "virsh list |grep " + vm_name + "|awk '{print $3}'"
+                cmd = "virsh list |awk '/" + vm_name + "/ {print $3}'"
                 try:
                     result = execute(cmd).strip()
                 except:
@@ -641,7 +641,7 @@ def cleanup_rules():
             if 1 in [ chain.startswith(c) for c in ['r-', 'i-', 's-', 'v-'] ]:
                 vm_name = chain
     
-                cmd = "virsh list |grep " + vm_name + "|awk '{print $3}'"
+                cmd = "virsh list |awk '/" + vm_name + "/ {print $3}'"
                 try:
                     result = execute(cmd).strip()
                 except:
@@ -869,7 +869,7 @@ def getBridges(vmName):
     return list(set(bridges))
 
 def getvmId(vmName):
-    cmd = "virsh list |grep " + vmName + " | awk '{print $1}'"
+    cmd = "virsh list |awk '/" + vmName + "/ {print $1}'"
     return bash("-c", cmd).stdout.strip()
     
 def addFWFramework(brname):