diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 2c027c36879..644cf3a091e 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -36,7 +36,7 @@ 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'): + path='client/api'): self.loglevel() # Turn off requests logs self.apiKey = mgmtDet.apiKey self.securityKey = mgmtDet.securityKey @@ -49,7 +49,8 @@ class cloudConnection(object): self.logging = logging self.path = path self.retries = 5 - self.protocol = scheme + self.mgtDetails = mgmtDet + self.protocol = "http" self.asyncTimeout = asyncTimeout self.auth = True if self.port == 8096 or \ @@ -61,11 +62,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 3e833c7ecfd..0f96a2cb626 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -41,8 +41,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 =\ @@ -148,12 +149,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 0fe3c26adbf..d046235cee8 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 )