mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fix code generator, some api response is empty
This commit is contained in:
parent
9c47f6bd94
commit
1600d70ca3
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user