fix credential snapshot
This commit is contained in:
parent
b4a4ce5275
commit
af9486920b
|
@ -10,7 +10,7 @@ logger = logging.getLogger('django')
|
||||||
class BuildMix:
|
class BuildMix:
|
||||||
def __init__(self, evidence_json):
|
def __init__(self, evidence_json):
|
||||||
self.json = evidence_json
|
self.json = evidence_json
|
||||||
self.uuid = self.json['uuid']
|
self.uuid = self.json.get('uuid')
|
||||||
self.manufacturer = ""
|
self.manufacturer = ""
|
||||||
self.model = ""
|
self.model = ""
|
||||||
self.serial_number = ""
|
self.serial_number = ""
|
||||||
|
|
|
@ -49,6 +49,7 @@ class Build(BuildMix):
|
||||||
if not self.json.get("credentialSubject"):
|
if not self.json.get("credentialSubject"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.uuid = self.json.get("credentialSubject", {}).get("uuid")
|
||||||
self.json.update(self.json["credentialSubject"])
|
self.json.update(self.json["credentialSubject"])
|
||||||
if self.json.get("evidence"):
|
if self.json.get("evidence"):
|
||||||
self.json["data"] = {}
|
self.json["data"] = {}
|
||||||
|
|
|
@ -39,11 +39,12 @@ class Build:
|
||||||
4) normal snapshot from worbench-script is the most basic and is parsed as normal_parse
|
4) normal snapshot from worbench-script is the most basic and is parsed as normal_parse
|
||||||
"""
|
"""
|
||||||
self.evidence = evidence_json.copy()
|
self.evidence = evidence_json.copy()
|
||||||
self.uuid = self.evidence['uuid']
|
self.uuid = self.evidence.get('uuid')
|
||||||
self.user = user
|
self.user = user
|
||||||
|
|
||||||
if evidence_json.get("credentialSubject"):
|
if evidence_json.get("credentialSubject"):
|
||||||
self.build = normal_parse.Build(evidence_json)
|
self.build = normal_parse.Build(evidence_json)
|
||||||
|
self.uuid = evidence_json.get("credentialSubject", {}).get("uuid")
|
||||||
elif evidence_json.get("software") != "workbench-script":
|
elif evidence_json.get("software") != "workbench-script":
|
||||||
self.build = old_parse.Build(evidence_json)
|
self.build = old_parse.Build(evidence_json)
|
||||||
elif evidence_json.get("data",{}).get("lshw"):
|
elif evidence_json.get("data",{}).get("lshw"):
|
||||||
|
|
Loading…
Reference in a new issue