mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
394f2e359f
commit
5545bcaa9d
@ -302,7 +302,7 @@ class TestInternalLb(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls._cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls._cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -842,6 +842,9 @@ class TestInternalLb(cloudstackTestCase):
|
|||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
cls.logger.debug("Cleaning up class resources")
|
cls.logger.debug("Cleaning up class resources")
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls._cleanup)
|
cleanup_resources(cls.apiclient, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
|
|||||||
@ -299,7 +299,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced"], required_hardware="true")
|
@attr(tags=["advanced"], required_hardware="true")
|
||||||
@ -435,6 +435,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cls.logger.debug("Cleaning up resources")
|
cls.logger.debug("Cleaning up resources")
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
@ -479,7 +482,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def _get_ssh_client(self, virtual_machine, services, retries):
|
def _get_ssh_client(self, virtual_machine, services, retries):
|
||||||
@ -798,6 +801,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
@ -842,7 +848,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def _validate_vpc_offering(self, vpc_offering):
|
def _validate_vpc_offering(self, vpc_offering):
|
||||||
@ -1165,6 +1171,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user