CLOUDSTACK-9531: Try template teardown without failure

As per previous discussions and ticket, a template deletion may result in failure
(exception thrown) for templates that are not properly downloaded. The tearDown
method, a template may be tried for deletion but on failure we may ignore it
as account deletion/tearDown would retry to cleanup resource owned by the account.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-10-04 17:42:53 +05:30
parent 394f2e359f
commit 5545bcaa9d
2 changed files with 16 additions and 4 deletions

View File

@ -302,7 +302,7 @@ class TestInternalLb(cloudstackTestCase):
%s" % (cls.account.name,
cls.account.id))
cls._cleanup = [cls.template, cls.account, cls.compute_offering]
cls._cleanup = [cls.account, cls.compute_offering]
return
def setUp(self):
@ -842,6 +842,9 @@ class TestInternalLb(cloudstackTestCase):
def tearDownClass(cls):
try:
cls.logger.debug("Cleaning up class resources")
try:
cls.template.delete(cls.apiclient)
except Exception: pass
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Cleanup failed with %s" % e)

View File

@ -299,7 +299,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
%s" % (cls.account.name,
cls.account.id))
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
cls.cleanup = [cls.account, cls.compute_offering]
return
@attr(tags=["advanced"], required_hardware="true")
@ -435,6 +435,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
try:
cls.logger.debug("Cleaning up resources")
try:
cls.template.delete(cls.apiclient)
except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
@ -479,7 +482,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
%s" % (cls.account.name,
cls.account.id))
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
cls.cleanup = [cls.account, cls.compute_offering]
return
def _get_ssh_client(self, virtual_machine, services, retries):
@ -798,6 +801,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
try:
cls.template.delete(cls.apiclient)
except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
@ -842,7 +848,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
%s" % (cls.account.name,
cls.account.id))
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
cls.cleanup = [cls.account, cls.compute_offering]
return
def _validate_vpc_offering(self, vpc_offering):
@ -1165,6 +1171,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
try:
cls.template.delete(cls.apiclient)
except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)