Repository: cloudstack
Updated Branches:
  refs/heads/master 5f816e3e3 -> 7ff7e9cf5


CLOUDSTACK-7268: Ignore "already exists" error in createEgressFirewallRule

Signed-off-by: Santhosh Edukulla <santhosh.eduku...@gmail.com>


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

Branch: refs/heads/master
Commit: 7ff7e9cf5ae4d5ababa0bf7e7ccb4a8cb1064045
Parents: 5f816e3
Author: John Dilley <john.dil...@citrix.com>
Authored: Thu Aug 7 07:40:06 2014 +0000
Committer: Santhosh Edukulla <santhosh.eduku...@gmail.com>
Committed: Thu Aug 7 14:26:40 2014 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ff7e9cf/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 80596fc..f0d53a6 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -24,7 +24,7 @@ from marvin.cloudstackAPI import *
 from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED,
                           STARTING, DESTROYED, EXPUNGING,
                           STOPPING, BACKED_UP, BACKING_UP)
-from marvin.cloudstackException import GetDetailExceptionInfo
+from marvin.cloudstackException import GetDetailExceptionInfo, 
CloudstackAPIException
 from marvin.lib.utils import validateList, is_server_ssh_ready, random_gen
 # Import System modules
 import time
@@ -340,12 +340,17 @@ class VirtualMachine:
             ipaddressid=public_ip.ipaddress.id
         )
         if allow_egress:
-            EgressFireWallRule.create(
-                apiclient=apiclient,
-                networkid=virtual_machine.nic[0].networkid,
-                protocol='All',
-                cidrlist='0.0.0.0/0'
-            )
+            try:
+                EgressFireWallRule.create(
+                    apiclient=apiclient,
+                    networkid=virtual_machine.nic[0].networkid,
+                    protocol='All',
+                    cidrlist='0.0.0.0/0'
+                )
+            except CloudstackAPIException, e:
+                # This could fail because we've already set up the same rule
+                if not "There is already a firewall rule specified".lower() in 
e.errorMsg.lower():
+                    raise
         virtual_machine.ssh_ip = nat_rule.ipaddress
         virtual_machine.public_ip = nat_rule.ipaddress
 

Reply via email to