diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index d006002ae0f..caa8609e14a 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -149,7 +149,7 @@ class CSConnection(object): [str.lower(r[0]), str.lower( urllib.quote_plus(str(r[1])) - ).replace("+", "%20")] + ).replace("+", "%20")] ) for r in params] ) signature = base64.encodestring(hmac.new( diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py index 1e02ddfb379..e5015c6dfd7 100644 --- a/tools/marvin/marvin/codegenerator.py +++ b/tools/marvin/marvin/codegenerator.py @@ -343,7 +343,7 @@ class CodeGenerator(object): paramProperty.desc = response['description'] if 'type' in response: if response['type'] in ['list', 'map', 'set']: - # Here list becomes a subproperty + # Here list becomes a subproperty if 'response' in response: for innerResponse in response['response']: subProperty =\ @@ -359,9 +359,9 @@ class CodeGenerator(object): jsonOut = apiStream.readlines() assert len(jsonOut) > 0 apiDict = json.loads(jsonOut[0]) - if not 'listapisresponse' in apiDict: + if 'listapisresponse' not in apiDict: raise Exception("API discovery plugin response failed") - if not 'count' in apiDict['listapisresponse']: + if 'count' not in apiDict['listapisresponse']: raise Exception("Malformed api response") apilist = apiDict['listapisresponse']['api'] @@ -397,7 +397,8 @@ class CodeGenerator(object): csCmd.request.append(paramProperty) for response in cmd['response']: - # FIXME: ExtractImage related APIs return empty dicts in response + # FIXME: ExtractImage related APIs return empty dicts in + # response if len(response) > 0: paramProperty = self.constructResponseFromJSON(response) csCmd.response.append(paramProperty) @@ -412,11 +413,11 @@ class CodeGenerator(object): @return: The classes in cloudstackAPI/ formed from api discovery json """ if endpointUrl.find('response=json') >= 0: - apiStream = urllib2.urlopen(endpointUrl) - cmds = self.loadCmdFromJSON(apiStream) - for cmd in cmds: - self.generate(cmd) - self.finalize() + apiStream = urllib2.urlopen(endpointUrl) + cmds = self.loadCmdFromJSON(apiStream) + for cmd in cmds: + self.generate(cmd) + self.finalize() def getText(elements): diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py index 28e907cbcd8..660193a1b4c 100644 --- a/tools/marvin/marvin/codes.py +++ b/tools/marvin/marvin/codes.py @@ -74,5 +74,5 @@ ADMIN = 1 DOMAIN_ADMIN = 2 USER = 0 XEN_SERVER = "XenServer" -ADMIN_ACCOUNT='ADMIN_ACCOUNT' -USER_ACCOUNT='USER_ACCOUNT' +ADMIN_ACCOUNT = 'ADMIN_ACCOUNT' +USER_ACCOUNT = 'USER_ACCOUNT' diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py index 68ec24eb2bc..2a67bc13828 100644 --- a/tools/marvin/marvin/configGenerator.py +++ b/tools/marvin/marvin/configGenerator.py @@ -47,17 +47,20 @@ class dbServer(object): class configuration(object): + def __init__(self): self.name = None self.value = None class logger(object): + def __init__(self): self.LogFolderPath = None class cloudstackConfiguration(object): + def __init__(self): self.zones = [] self.mgtSvr = [] @@ -68,6 +71,7 @@ class cloudstackConfiguration(object): class zone(object): + def __init__(self): self.dns1 = None self.internaldns1 = None @@ -845,8 +849,8 @@ def descSetupInAdvancedsgMode(): memory = 8 * 1024 * 1024 * 1024 localstorage = 1 * 1024 * 1024 * 1024 * 1024 # h.url = "http://sim/%d%d%d%d/cpucore=1&cpuspeed=8000&\ - # memory=%d&localstorage=%d" % (l, i, j, k, memory, - # localstorage) + # memory=%d&localstorage=%d" % (l, i, j, k, memory, + # localstorage) h.url = "http://sim/%d%d%d%d" % (l, i, j, k) c.hosts.append(h) @@ -855,8 +859,6 @@ def descSetupInAdvancedsgMode(): primary = primaryStorage() primary.name = "primary" + \ str(l) + str(i) + str(j) + str(m) - # primary.url = "nfs://localhost/path%s/size=%d" % \ - #(str(l) + str(i) + str(j) + str(m), size) primary.url = "nfs://localhost/path%s" % \ (str(l) + str(i) + str(j) + str(m)) c.primaryStorages.append(primary) diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py index d3b6b8606b0..9f392e5e5a3 100644 --- a/tools/marvin/marvin/deployAndRun.py +++ b/tools/marvin/marvin/deployAndRun.py @@ -97,8 +97,8 @@ def startMarvin(cfg_file, load_flag): print "\nMarvin Initialization Failed" exit(1) except Exception as e: - print "\n Exception occurred while starting Marvin %s" % str(e) - exit(1) + print "\n Exception occurred while starting Marvin %s" % str(e) + exit(1) def runTCs(num_iter, inp1, inp2): diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py index 3f48a00ba68..324d339606b 100644 --- a/tools/marvin/marvin/jsonHelper.py +++ b/tools/marvin/marvin/jsonHelper.py @@ -14,7 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - import cloudstackException import json import inspect diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py index c35fec6adc1..b6b3cec4875 100644 --- a/tools/marvin/marvin/marvinInit.py +++ b/tools/marvin/marvin/marvinInit.py @@ -134,11 +134,11 @@ class MarvinInit: ''' try: if ((self.__parseConfig() != FAILED) and - (self.__setHypervisorAndZoneInfo())and - (self.__setTestDataPath() != FAILED) and - (self.__initLogging() != FAILED) and - (self.__createTestClient() != FAILED) and - (self.__deployDC() != FAILED)): + (self.__setHypervisorAndZoneInfo())and + (self.__setTestDataPath() != FAILED) and + (self.__initLogging() != FAILED) and + (self.__createTestClient() != FAILED) and + (self.__deployDC() != FAILED)): return SUCCESS return FAILED except Exception as e: @@ -187,13 +187,12 @@ class MarvinInit: try: mgt_details = self.__parsedConfig.mgtSvr[0] dbsvr_details = self.__parsedConfig.dbSvr - self.__testClient = CSTestClient(mgt_details, dbsvr_details, - logger=self.__tcRunLogger, - test_data_filepath= - self.__testDataFilePath, - zone=self.__zoneForTests, - hypervisor_type= - self.__hypervisorType) + self.__testClient = CSTestClient( + mgt_details, dbsvr_details, + logger=self.__tcRunLogger, + test_data_filepath=self.__testDataFilePath, + zone=self.__zoneForTests, + hypervisor_type=self.__hypervisorType) if self.__testClient: return self.__testClient.createTestClient() return FAILED diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py index 4200a657e71..c817cd69535 100644 --- a/tools/marvin/marvin/marvinPlugin.py +++ b/tools/marvin/marvin/marvinPlugin.py @@ -302,6 +302,6 @@ class MarvinPlugin(Plugin): cmd = "mv " + src + " " + dst os.system(cmd) print "===final results are now copied to: %s===" % str(dst) - except Exception, e: + except Exception as e: print "=== Exception occurred under finalize :%s ===" % \ str(GetDetailExceptionInfo(e)) diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py index 611c8b5312c..76f3b6dd597 100644 --- a/tools/marvin/marvin/sshClient.py +++ b/tools/marvin/marvin/sshClient.py @@ -204,9 +204,9 @@ class SshClient(object): self.close() def close(self): - if self.ssh is not None: - self.ssh.close() - self.ssh = None + if self.ssh is not None: + self.ssh.close() + self.ssh = None if __name__ == "__main__":