diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index a56dd68f0f1..64a43f8a4cd 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -34,7 +34,8 @@ from requests import RequestException class cloudConnection(object): """ Connections to make API calls to the cloudstack management server """ - def __init__(self, mgmtDet,asyncTimeout=3600, logging=None, scheme='http',path='client/api'): + def __init__(self, mgmtDet, asyncTimeout=3600, logging=None, + path='client/api'): self.loglevel() # Turn off requests logs self.apiKey = mgmtDet.apiKey self.securityKey = mgmtDet.securityKey @@ -47,6 +48,7 @@ class cloudConnection(object): self.logging = logging self.path = path self.retries = 5 + self.mgtDetails = mgmtDet self.protocol = "http" self.asyncTimeout = asyncTimeout self.auth = True @@ -59,11 +61,9 @@ class cloudConnection(object): % (self.protocol, self.mgtSvr, self.port, self.path) def __copy__(self): - return cloudConnection(self.mgtSvr, self.port, self.user, - self.passwd, self.apiKey, - self.securityKey, - self.asyncTimeout, self.logging, - self.protocol, + return cloudConnection(self.mgtDetails, + self.asyncTimeout, + self.logging, self.path) def loglevel(self, lvl=logging.WARNING): diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index 916219c3326..b3826a72130 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -52,8 +52,9 @@ class cloudstackTestClient(object): dbSvrDetails, asyncTimeout=3600, defaultWorkerThreads=10, logging=None): + self.mgmtDetails = mgmtDetails self.connection = \ - cloudstackConnection.cloudConnection(mgmtDetails, + cloudstackConnection.cloudConnection(self.mgmtDetails, asyncTimeout, logging) self.apiClient =\ @@ -158,12 +159,12 @@ class cloudstackTestClient(object): apiKey = registerUserRes.apikey securityKey = registerUserRes.secretkey + mgtDetails = self.mgmtDetails + mgtDetails.apiKey = apiKey + mgtDetails.securityKey = securityKey + newUserConnection =\ - cloudstackConnection.cloudConnection(self.connection.mgtSvr, - self.connection.port, - self.connection.user, - self.connection.passwd, - apiKey, securityKey, + cloudstackConnection.cloudConnection(mgtDetails, self.connection.asyncTimeout, self.connection.logging) self.userApiClient =\ diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py index 4e7fe825ee7..d4d180e6794 100644 --- a/tools/marvin/marvin/integration/lib/utils.py +++ b/tools/marvin/marvin/integration/lib/utils.py @@ -157,10 +157,7 @@ def fetch_api_client(config_file='datacenterCfg'): asyncTimeout = 3600 return cloudstackAPIClient.CloudStackAPIClient( marvin.cloudstackConnection.cloudConnection( - mgt.mgtSvrIp, - mgt.port, - mgt.apiKey, - mgt.securityKey, + mgt, asyncTimeout, testClientLogger ) diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/utils.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/utils.py index f26d2c0212b..0c7ca497ded 100644 --- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/utils.py +++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/utils.py @@ -76,10 +76,7 @@ def fetch_api_client(config_file='datacenterCfg'): asyncTimeout = 3600 return cloudstackAPIClient.CloudStackAPIClient( cloudstackConnection.cloudConnection( - mgt.mgtSvrIp, - mgt.port, - mgt.apiKey, - mgt.securityKey, + mgt, asyncTimeout, testClientLogger )