Skip to content

Commit a522a61

Browse files
author
Daan Hoogland
committed
configdrive syntax, fixed to be up to par with py2
1 parent e11614c commit a522a61

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

test/integration/component/test_configdrive.py

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import time
6161
from contextlib import contextmanager
6262
from nose.plugins.attrib import attr
63-
from retry import retry
6463

6564
VPC_SERVICES = 'Dhcp,StaticNat,SourceNat,NetworkACL,UserData,Dns'
6665
ISO_SERVICES = 'Dhcp,SourceNat,StaticNat,UserData,Firewall,Dns'
@@ -1187,7 +1186,7 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils):
11871186
"""
11881187

11891188
def __init__(self, methodName='runTest'):
1190-
super(cloudstackTestCase, self).__init__(methodName)
1189+
super(TestConfigDrive, self).__init__(methodName)
11911190
ConfigDriveUtils.__init__(self)
11921191

11931192
@classmethod
@@ -1200,6 +1199,7 @@ def setUpClass(cls):
12001199
cls.db_client = test_client.getDbConnection()
12011200
cls.test_data = test_client.getParsedTestDataConfig()
12021201
cls.test_data.update(Services().services)
1202+
cls._cleanup = []
12031203

12041204
# Get Zone, Domain and templates
12051205
cls.zone = get_zone(cls.api_client)
@@ -1217,58 +1217,35 @@ def setUpClass(cls):
12171217
cls.service_offering = ServiceOffering.create(
12181218
cls.api_client,
12191219
cls.test_data["service_offering"])
1220-
cls._cleanup = [cls.service_offering]
1220+
cls._cleanup.append(cls.service_offering)
12211221

12221222
hypervisors = Hypervisor.list(cls.api_client, zoneid=cls.zone.id)
12231223
cls.isSimulator = any(h.name == "Simulator" for h in hypervisors)
12241224
return
12251225

12261226
def setUp(self):
12271227
# Create an account
1228+
self.cleanup = []
12281229
self.account = Account.create(self.api_client,
12291230
self.test_data["account"],
12301231
admin=True,
12311232
domainid=self.domain.id
12321233
)
1234+
self.cleanup.append(self.account)
12331235
self.tmp_files = []
1234-
self.cleanup = [self.account]
12351236
self.generate_ssh_keys()
12361237
return
12371238

12381239
@classmethod
12391240
def tearDownClass(cls):
1240-
# Cleanup resources used
1241-
cls.debug("Cleaning up the resources")
1242-
for obj in reversed(cls._cleanup):
1243-
try:
1244-
if isinstance(obj, VirtualMachine):
1245-
obj.delete(cls.api_client, expunge=True)
1246-
else:
1247-
obj.delete(cls.api_client)
1248-
except Exception as e:
1249-
cls.error("Failed to cleanup %s, got %s" % (obj, e))
1250-
# cleanup_resources(cls.api_client, cls._cleanup)
1251-
cls._cleanup = []
1252-
cls.debug("Cleanup complete!")
1253-
return
1241+
super(TestConfigDrive, cls).tearDownClass()
12541242

12551243
def tearDown(self):
1256-
# Cleanup resources used
1257-
self.debug("Cleaning up the resources")
1258-
for obj in reversed(self.cleanup):
1259-
try:
1260-
if isinstance(obj, VirtualMachine):
1261-
obj.delete(self.api_client, expunge=True)
1262-
else:
1263-
obj.delete(self.api_client)
1264-
except Exception as e:
1265-
self.error("Failed to cleanup %s, got %s" % (obj, e))
1266-
# cleanup_resources(self.api_client, self.cleanup)
1267-
self.cleanup = []
1244+
super(TestConfigDrive,self).tearDown()
1245+
12681246
for tmp_file in self.tmp_files:
12691247
os.remove(tmp_file)
12701248
self.debug("Cleanup complete!")
1271-
return
12721249

12731250
# create_StaticNatRule_For_VM - Creates Static NAT rule on the given
12741251
# public IP for the given VM in the given network

0 commit comments

Comments
 (0)