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 <talluri@apache.org>
This commit is contained in:
root 2014-04-29 21:22:20 +10:00 committed by SrikanteswaraRao Talluri
parent 4bc9f74b2d
commit 56a44151aa
9 changed files with 36 additions and 35 deletions

View File

@ -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(

View File

@ -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):

View File

@ -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'

View File

@ -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)

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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__":