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/HTTPParser.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/HTTPParser.py')
-rw-r--r-- | src/HTTPParser.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/HTTPParser.py b/src/HTTPParser.py index 1a3d7be..7ee8972 100644 --- a/src/HTTPParser.py +++ b/src/HTTPParser.py @@ -15,6 +15,9 @@ class HTTPParser: self.cmd = None self.partition = None self.disk = None + self.cache = None + self.cache_size = None + self.partition_setup = None def parser(self,data): self.requestLine, self.headersAlone = data.split('\n', 1) @@ -49,7 +52,17 @@ class HTTPParser: self.disk = jsoncmd["disk"] if "partition" in cmd: - self.partition = jsoncmd["partition"] + if not "partition_setup" in cmd: + self.partition = jsoncmd["partition"] + + if "cache" in cmd: + self.cache = jsoncmd["cache"] + + if "cache_size" in cmd: + self.cache_size = jsoncmd["cache_size"] + + if "partition_setup" in cmd: + self.partition_setup = jsoncmd["partition_setup"] def getHeaderLine(self): return self.headersAlone @@ -83,3 +96,12 @@ class HTTPParser: def getPartition(self): return self.partition + + def getCache(self): + return self.cache + + def getCacheSize(self): + return self.cache_size + + def getPartitionSetup(self): + return self.partition_setup |