mirror of https://git.48k.eu/ogclient
Improve /image/create command response
With this new patch, the image/create command will create a response message with more information for the server. The new format is: {"disk" : "1", "partition" : "1", "code" : "1", "id" : "1", "name" : "test", "repository" : "192.168.2.4", "software" : "xyz"} "xyz" will be the output saved during the execution of InventarioSoftware in a specific path.more_events
parent
b5e182f7dd
commit
5603a280ef
|
@ -32,6 +32,7 @@ class HTTPParser:
|
|||
self.profile = None
|
||||
self.id = None
|
||||
self.echo = None
|
||||
self.code = None
|
||||
|
||||
def parser(self,data):
|
||||
self.requestLine, self.headersAlone = data.split('\n', 1)
|
||||
|
@ -97,6 +98,9 @@ class HTTPParser:
|
|||
if "id" in cmd:
|
||||
self.id = jsoncmd["id"]
|
||||
|
||||
if "code" in cmd:
|
||||
self.code = jsoncmd["code"]
|
||||
|
||||
def getHeaderLine(self):
|
||||
return self.headersAlone
|
||||
|
||||
|
@ -156,3 +160,6 @@ class HTTPParser:
|
|||
|
||||
def getEcho(self):
|
||||
return self.echo
|
||||
|
||||
def getCode(self):
|
||||
return self.code
|
||||
|
|
|
@ -159,6 +159,13 @@ class ogThread():
|
|||
client.send(restResponse.getResponse(ogResponses.INTERNAL_ERR))
|
||||
return
|
||||
|
||||
jsonResp = jsonResponse()
|
||||
jsonResp.addElement('disk', httpparser.getDisk())
|
||||
jsonResp.addElement('partition', httpparser.getPartition())
|
||||
jsonResp.addElement('code', httpparser.getCode())
|
||||
jsonResp.addElement('id', httpparser.getId())
|
||||
jsonResp.addElement('name', httpparser.getName())
|
||||
jsonResp.addElement('repository', httpparser.getRepo())
|
||||
f = open(path, "r")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
|
|
Loading…
Reference in New Issue