Repository: cloudstack Updated Branches: refs/heads/master 4bc9f74b2 -> 56a44151a
Fixed pep8 issues arising as part of merge Fixed pep8 issues arising as part of merge Signed-off-by: root <root@localhost.localdomain> Signed-off-by: SrikanteswaraRao Talluri <tall...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/56a44151 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/56a44151 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/56a44151 Branch: refs/heads/master Commit: 56a44151aa31a8aac05b7a35d629af5714318ccb Parents: 4bc9f74 Author: root <root@localhost.localdomain> Authored: Tue Apr 29 21:22:20 2014 +1000 Committer: SrikanteswaraRao Talluri <tall...@apache.org> Committed: Tue Apr 29 19:36:09 2014 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/cloudstackConnection.py | 2 +- tools/marvin/marvin/codegenerator.py | 19 ++++++++++--------- tools/marvin/marvin/codes.py | 4 ++-- tools/marvin/marvin/configGenerator.py | 10 ++++++---- tools/marvin/marvin/deployAndRun.py | 4 ++-- tools/marvin/marvin/jsonHelper.py | 1 - tools/marvin/marvin/marvinInit.py | 23 +++++++++++------------ tools/marvin/marvin/marvinPlugin.py | 2 +- tools/marvin/marvin/sshClient.py | 6 +++--- 9 files changed, 36 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/cloudstackConnection.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index d006002..caa8609 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( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/codegenerator.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py index 1e02ddf..e5015c6 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): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/codes.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py index 28e907c..660193a 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' http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/configGenerator.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py index 68ec24e..2a67bc1 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) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/deployAndRun.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py index d3b6b86..9f392e5 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): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/jsonHelper.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py index 3f48a00..324d339 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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/marvinInit.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py index c35fec6..b6b3cec 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 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/marvinPlugin.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py index 4200a65..c817cd6 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)) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56a44151/tools/marvin/marvin/sshClient.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py index 611c8b5..76f3b6d 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__":