(Clean-Up) Rename jsoncmd variable to json_param

more_events
Alvaro Neira Ayuso 2020-01-18 13:56:25 +01:00 committed by Alvaro Neira Ayuso
parent 5603a280ef
commit 51ad896dee
1 changed files with 14 additions and 14 deletions

View File

@ -55,51 +55,51 @@ class HTTPParser:
msgs = self.headersAlone.rstrip().split('\n') msgs = self.headersAlone.rstrip().split('\n')
cmd = msgs[len(msgs) - 1] cmd = msgs[len(msgs) - 1]
try: try:
jsoncmd = json.loads(cmd) json_param = json.loads(cmd)
except ValueError as e: except ValueError as e:
print ("Error: Json message incomplete") print ("Error: Json message incomplete")
return return
if "run" in cmd: if "run" in cmd:
self.cmd = jsoncmd["run"] self.cmd = json_param["run"]
try: try:
self.echo = jsoncmd["echo"] self.echo = json_param["echo"]
except: except:
pass pass
if "disk" in cmd: if "disk" in cmd:
self.disk = jsoncmd["disk"] self.disk = json_param["disk"]
if "partition" in cmd: if "partition" in cmd:
if not "partition_setup" in cmd: if not "partition_setup" in cmd:
self.partition = jsoncmd["partition"] self.partition = json_param["partition"]
if "cache" in cmd: if "cache" in cmd:
self.cache = jsoncmd["cache"] self.cache = json_param["cache"]
if "cache_size" in cmd: if "cache_size" in cmd:
self.cache_size = jsoncmd["cache_size"] self.cache_size = json_param["cache_size"]
if "partition_setup" in cmd: if "partition_setup" in cmd:
self.partition_setup = jsoncmd["partition_setup"] self.partition_setup = json_param["partition_setup"]
if "name" in cmd: if "name" in cmd:
self.name = jsoncmd["name"] self.name = json_param["name"]
if "repository" in cmd: if "repository" in cmd:
self.repo = jsoncmd["repository"] self.repo = json_param["repository"]
if "type" in cmd: if "type" in cmd:
self.type = jsoncmd["type"] self.type = json_param["type"]
if "profile" in cmd: if "profile" in cmd:
self.profile = jsoncmd["profile"] self.profile = json_param["profile"]
if "id" in cmd: if "id" in cmd:
self.id = jsoncmd["id"] self.id = json_param["id"]
if "code" in cmd: if "code" in cmd:
self.code = jsoncmd["code"] self.code = json_param["code"]
def getHeaderLine(self): def getHeaderLine(self):
return self.headersAlone return self.headersAlone