diff options
author | Alvaro Neira Ayuso <aneira@soleta.eu> | 2020-01-02 21:37:01 +0100 |
---|---|---|
committer | Alvaro Neira Ayuso <alvaroneay@gmail.com> | 2020-01-19 19:50:44 +0100 |
commit | efbe8a7960f5a6f92134fc8b0f4c946a7664a5f0 (patch) | |
tree | 4c3f8148315c97979a4f91e6bce792fc0eab3caa /src/ogRest.py | |
parent | 9fd8f2dbd0bf1edd05eaf94d6a067f5709cfb573 (diff) |
Add setup command for configuring the machine
ogAdmClient has a support to configure the machines. This new command allows
the new ogClient to execute the same script to configure the machine.
The json format sent from the server must be:
{ "disk" : "1", "cache" : "0", "cache_size" : "70000000",\
"partition_setup": [{"partition": "1", "code": "NTFS", "filesystem": "NTFS",\
"size": "11000000", "format": "0"}]}
Diffstat (limited to 'src/ogRest.py')
-rw-r--r-- | src/ogRest.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ogRest.py b/src/ogRest.py index ddedf16..43e3920 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -50,6 +50,10 @@ class ogThread(): msgqueue.queue.clear() msgqueue.put(ogOperations.prochardware(path)) + # Process setup + def procsetup(msgqueue, disk, cache, cachesize, partlist): + ogOperations.procsetup(disk, cache, cachesize, partlist) + class ogResponses(Enum): BAD_REQUEST=0 IN_PROGRESS=1 @@ -103,6 +107,8 @@ class ogRest(): self.process_session(client, httpparser.getDisk(), httpparser.getPartition()) elif ("software" in URI): self.process_software(client, httpparser.getDisk(), httpparser.getPartition()) + elif ("setup" in URI): + self.process_setup(client, httpparser.getDisk(), httpparser.getCache(), httpparser.getCacheSize(), httpparser.getPartitionSetup()) else: client.send(self.getResponse(ogResponses.BAD_REQUEST)) else: @@ -162,3 +168,7 @@ class ogRest(): def process_schedule(self, client): client.send(self.getResponse(ogResponses.OK)) + + def process_setup(self, client, disk, cache, cachesize, partlist): + threading.Thread(target=ogThread.procsetup, args=(self.msgqueue, disk, cache, cachesize, partlist,)).start() + client.send(self.getResponse(ogResponses.OK)) |