summaryrefslogtreecommitdiffstats
path: root/src/ogRest.py
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2020-01-14 13:02:45 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit38b57c4ae43e062049d8a2a1a33f9a790a18b327 (patch)
tree4cb34789ab0d18936f21cea82d127d2d3f39381c /src/ogRest.py
parenta306b8b9d8cc3248f05dd4b5971a6ddd97ab1cde (diff)
Improve setup command response
This patch adds a new response support. This way allows us to send a new response message with more information about the partitions already set up. The format of the response is: { "disk" : "1", "cache" : "1", "cache_size" : "0", "partition_setup": [{"partition": "1", "code": "LINUX", "filesystem": "EMPTY", "size": "498688", "format": "0"}...]
Diffstat (limited to 'src/ogRest.py')
-rw-r--r--src/ogRest.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index 5119eea..cf7a4ee 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -102,8 +102,14 @@ class ogThread():
client.send(restResponse.getResponse(ogResponses.OK, jsonResp))
# Process setup
- def procsetup(msgqueue, httpparser):
- ogOperations.procsetup(httpparser)
+ def procsetup(client, httpparser):
+ jsonResp = jsonResponse()
+ jsonResp.addElement('disk', httpparser.getDisk())
+ jsonResp.addElement('cache', httpparser.getCache())
+ jsonResp.addElement('cache_size', httpparser.getCacheSize())
+ listconfig = ogOperations.procsetup(httpparser)
+ jsonResp.addElement('partition_setup', listconfig)
+ client.send(restResponse.getResponse(ogResponses.OK, jsonResp))
# Process image restore
def procirestore(httpparser):
@@ -212,8 +218,7 @@ class ogRest():
client.send(restResponse.getResponse(ogResponses.OK))
def process_setup(self, client, httpparser):
- threading.Thread(target=ogThread.procsetup, args=(self.msgqueue, httpparser,)).start()
- client.send(restResponse.getResponse(ogResponses.OK))
+ threading.Thread(target=ogThread.procsetup, args=(client, httpparser,)).start()
def process_irestore(self, client, httpparser):
threading.Thread(target=ogThread.procirestore, args=(client, httpparser,)).start()