fix code generator, some api response is empty

This commit is contained in:
Edison Su 2011-08-15 13:56:36 -07:00
parent 9c47f6bd94
commit 1600d70ca3
2 changed files with 11 additions and 20 deletions

View File

@ -1,5 +1,4 @@
import cloudstackConnection
import remoteSSHClient
import asyncJobMgr
import dbConnection
from cloudstackAPI import *
@ -20,17 +19,6 @@ class cloudstackTestClient(object):
def getDbConnection(self):
return self.dbConnection
def remoteSSHConfigure(self, host, port, user, passwd):
self.ssh = remoteSSHClient.remoteSSHClient(host, port, user, passwd)
def executeViaSSH(self, command):
if self.ssh is None:
return None
return self.ssh.execute(command)
def getSSHClient(self):
return self.ssh
def executeSql(self, sql=None):
if sql is None or self.dbConnection is None:

View File

@ -92,15 +92,18 @@ class codeGenerator:
self.code += "\n"
self.code += 'class %sResponse (baseResponse):\n'%self.cmd.name
self.code += self.space + "def __init__(self):\n"
for res in self.cmd.response:
if res.desc is not None:
self.code += self.space + self.space + '"""%s"""\n'%res.desc
if len(self.cmd.response) == 0:
self.code += self.space + self.space + "pass"
else:
for res in self.cmd.response:
if res.desc is not None:
self.code += self.space + self.space + '"""%s"""\n'%res.desc
if len(res.subProperties) > 0:
self.code += self.space + self.space + 'self.%s = []\n'%res.name
self.generateSubClass(res.name, res.subProperties)
else:
self.code += self.space + self.space + 'self.%s = None\n'%res.name
if len(res.subProperties) > 0:
self.code += self.space + self.space + 'self.%s = []\n'%res.name
self.generateSubClass(res.name, res.subProperties)
else:
self.code += self.space + self.space + 'self.%s = None\n'%res.name
self.code += '\n'
for subclass in self.subclass: