You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/06/28 15:31:41 UTC
git commit: updated refs/heads/master to 9e8cf60
Updated Branches:
refs/heads/master 209185217 -> 9e8cf60b3
upgrade marvin classes to new style python objects
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e8cf60b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e8cf60b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e8cf60b
Branch: refs/heads/master
Commit: 9e8cf60b34cdbe8f0e409cad8adae5bbb743c1ac
Parents: 2091852
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Fri Jun 28 19:00:45 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri Jun 28 19:01:31 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/cloudstackConnection.py | 3 +-
tools/marvin/marvin/codegenerator.py | 10 +++---
tools/marvin/marvin/configGenerator.py | 42 ++++++++++++------------
tools/marvin/marvin/deployDataCenter.py | 21 ++++++++----
tools/marvin/marvin/jsonHelper.py | 4 +--
5 files changed, 43 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8cf60b/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 9ccf5e2..9d60ff9 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -172,8 +172,7 @@ class cloudConnection(object):
requests = {}
required = []
for attribute in dir(cmd):
- if attribute != "__doc__" and attribute != "__init__" and\
- attribute != "__module__":
+ if not attribute.startswith('__'):
if attribute == "isAsync":
isAsync = getattr(cmd, attribute)
elif attribute == "required":
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8cf60b/tools/marvin/marvin/codegenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index 1f25e53..632b8c6 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -33,7 +33,7 @@ class cmdParameterProperty(object):
self.subProperties = []
-class cloudStackCmd:
+class cloudStackCmd(object):
def __init__(self):
self.name = ""
self.desc = ""
@@ -42,7 +42,7 @@ class cloudStackCmd:
self.response = []
-class codeGenerator:
+class codeGenerator(object):
"""
Apache CloudStack- marvin python classes can be generated from the json
returned by API discovery or from the xml spec of commands generated by
@@ -184,7 +184,7 @@ class codeGenerator:
imports = "import copy\n"
initCmdsList = '__all__ = ['
body = ''
- body += "class CloudStackAPIClient:\n"
+ body += "class CloudStackAPIClient(object):\n"
body += self.space + 'def __init__(self, connection):\n'
body += self.space + self.space + 'self.connection = connection\n'
body += "\n"
@@ -224,7 +224,7 @@ class codeGenerator:
fp = open(self.outputFolder + '/cloudstackAPI/baseCmd.py', 'w')
basecmd = self.license
basecmd += '"""Base Command"""\n'
- basecmd += 'class baseCmd:\n'
+ basecmd += 'class baseCmd(object):\n'
basecmd += self.space + 'pass\n'
fp.write(basecmd)
fp.close()
@@ -232,7 +232,7 @@ class codeGenerator:
fp = open(self.outputFolder + '/cloudstackAPI/baseResponse.py', 'w')
basecmd = self.license
basecmd += '"""Base class for response"""\n'
- basecmd += 'class baseResponse:\n'
+ basecmd += 'class baseResponse(object):\n'
basecmd += self.space + 'pass\n'
fp.write(basecmd)
fp.close()
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8cf60b/tools/marvin/marvin/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index a33a3f4..812bfec 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -21,7 +21,7 @@ from optparse import OptionParser
import jsonHelper
-class managementServer():
+class managementServer(object):
def __init__(self):
self.mgtSvrIp = None
self.port = 8096
@@ -29,7 +29,7 @@ class managementServer():
self.securityKey = None
-class dbServer():
+class dbServer(object):
def __init__(self):
self.dbSvr = None
self.port = 3306
@@ -38,20 +38,20 @@ class dbServer():
self.db = "cloud"
-class configuration():
+class configuration(object):
def __init__(self):
self.name = None
self.value = None
-class logger():
+class logger(object):
def __init__(self):
'''TestCase/TestClient'''
self.name = None
self.file = None
-class cloudstackConfiguration():
+class cloudstackConfiguration(object):
def __init__(self):
self.zones = []
self.mgtSvr = []
@@ -60,7 +60,7 @@ class cloudstackConfiguration():
self.logger = []
-class zone():
+class zone(object):
def __init__(self):
self.dns1 = None
self.internaldns1 = None
@@ -79,7 +79,7 @@ class zone():
self.cacheStorages = []
-class traffictype():
+class traffictype(object):
def __init__(self, typ, labeldict=None):
self.typ = typ # Guest/Management/Public
if labeldict:
@@ -96,7 +96,7 @@ class traffictype():
#}
-class pod():
+class pod(object):
def __init__(self):
self.gateway = None
self.name = None
@@ -109,7 +109,7 @@ class pod():
self.guestIpRanges = []
-class cluster():
+class cluster(object):
def __init__(self):
self.clustername = None
self.clustertype = None
@@ -123,7 +123,7 @@ class cluster():
self.primaryStorages = []
-class host():
+class host(object):
def __init__(self):
self.hypervisor = None
self.password = None
@@ -140,7 +140,7 @@ class host():
self.memory = None
-class physical_network():
+class physical_network(object):
def __init__(self):
self.name = None
self.tags = []
@@ -154,7 +154,7 @@ class physical_network():
self.providers = [vrouter]
-class provider():
+class provider(object):
def __init__(self, name=None):
self.name = name
self.state = None
@@ -164,7 +164,7 @@ class provider():
self.devices = []
-class network():
+class network(object):
def __init__(self):
self.displaytext = None
self.name = None
@@ -176,7 +176,7 @@ class network():
self.ipranges = []
-class iprange():
+class iprange(object):
def __init__(self):
'''tagged/untagged'''
self.gateway = None
@@ -189,27 +189,27 @@ class iprange():
self.domain = None
-class primaryStorage():
+class primaryStorage(object):
def __init__(self):
self.name = None
self.url = None
-class secondaryStorage():
+class secondaryStorage(object):
def __init__(self):
self.url = None
self.provider = None
self.details = None
-class cacheStorage():
+class cacheStorage(object):
def __init__(self):
self.url = None
self.provider = None
self.details = None
-class s3():
+class s3(object):
def __init__(self):
self.accesskey = None
self.secretkey = None
@@ -221,7 +221,7 @@ class s3():
self.usehttps = None
-class netscaler():
+class netscaler(object):
def __init__(self, hostname=None, username='nsroot', password='nsroot'):
self.hostname = hostname
self.username = username
@@ -242,7 +242,7 @@ class netscaler():
for r in req])
-class srx():
+class srx(object):
def __init__(self, hostname=None, username='root', password='admin'):
self.hostname = hostname
self.username = username
@@ -265,7 +265,7 @@ class srx():
for r in req])
-class bigip():
+class bigip(object):
def __init__(self, hostname=None, username='root', password='default'):
self.hostname = hostname
self.username = username
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8cf60b/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index b531787..4137124 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -25,7 +25,7 @@ from os import path
from optparse import OptionParser
-class deployDataCenters():
+class deployDataCenters(object):
def __init__(self, cfgFile):
if not path.exists(cfgFile) \
@@ -133,7 +133,6 @@ specify a valid config file" % cfgFile)
vlanipcmd.forvirtualnetwork = "false"
else:
vlanipcmd.forvirtualnetwork = "true"
-
self.apiClient.createVlanIpRange(vlanipcmd)
def createSecondaryStorages(self, secondaryStorages, zoneId):
@@ -145,9 +144,12 @@ specify a valid config file" % cfgFile)
secondarycmd.provider = secondary.provider
secondarycmd.details = []
- if isinstance(secondary.details, list):
- for item in secondary.details:
- secondarycmd.details.append(item.__dict__)
+ if secondarycmd.provider == 'S3':
+ for key, value in vars(secondary.details).iteritems():
+ secondarycmd.details.append({
+ 'key': key,
+ 'value': value
+ })
if secondarycmd.provider == "NFS":
secondarycmd.zoneid = zoneId
self.apiClient.addImageStore(secondarycmd)
@@ -161,8 +163,13 @@ specify a valid config file" % cfgFile)
cachecmd.provider = cache.provider
cachecmd.zoneid = zoneId
cachecmd.details = []
- for item in cache.details:
- cachecmd.details.append(item.__dict__)
+
+ if cache.details:
+ for key, value in vars(cache.details).iteritems():
+ cachecmd.details.append({
+ 'key': key,
+ 'value': value
+ })
self.apiClient.createCacheStore(cachecmd)
def createnetworks(self, networks, zoneId):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e8cf60b/tools/marvin/marvin/jsonHelper.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py
index f940508..ae40b8d 100644
--- a/tools/marvin/marvin/jsonHelper.py
+++ b/tools/marvin/marvin/jsonHelper.py
@@ -21,7 +21,7 @@ import inspect
from cloudstackAPI import *
-class jsonLoader:
+class jsonLoader(object):
'''The recursive class for building and representing objects with.'''
def __init__(self, obj):
for k in obj:
@@ -51,7 +51,7 @@ class jsonLoader:
in self.__dict__.iteritems()))
-class jsonDump:
+class jsonDump(object):
@staticmethod
def __serialize(obj):
"""Recursively walk object's hierarchy."""