IdentityClaimProcessor rename measurements -> integrityMeasurements, temp -> deviceLiveLog

This commit is contained in:
chubtub 2024-10-30 15:13:01 -04:00
parent 7846b86010
commit 5250d648bf

View File

@ -350,7 +350,7 @@ public class IdentityClaimProcessor extends AbstractProcessor {
dv.getHw().getProductName()); dv.getHw().getProductName());
BaseReferenceManifest baseRim = null; BaseReferenceManifest baseRim = null;
SupportReferenceManifest supportRim = null; SupportReferenceManifest supportRim = null;
EventLogMeasurements measurements; EventLogMeasurements integrityMeasurements;
boolean isReplacement = false; boolean isReplacement = false;
String replacementRimId = ""; String replacementRimId = "";
String tagId = ""; String tagId = "";
@ -542,30 +542,30 @@ public class IdentityClaimProcessor extends AbstractProcessor {
fileName = String.format("%s.measurement", fileName = String.format("%s.measurement",
dv.getNw().getHostname()); dv.getNw().getHostname());
try { try {
EventLogMeasurements temp = new EventLogMeasurements(fileName, EventLogMeasurements deviceLiveLog = new EventLogMeasurements(fileName,
dv.getLivelog().toByteArray()); dv.getLivelog().toByteArray());
// find previous version. // find previous version.
measurements = referenceManifestRepository integrityMeasurements = referenceManifestRepository
.byMeasurementDeviceName(dv.getNw().getHostname()); .byMeasurementDeviceName(dv.getNw().getHostname());
if (measurements != null) { if (integrityMeasurements != null) {
// Find previous log and delete it // Find previous log and delete it
referenceManifestRepository.delete(measurements); referenceManifestRepository.delete(integrityMeasurements);
} }
List<BaseReferenceManifest> baseRims = referenceManifestRepository List<BaseReferenceManifest> baseRims = referenceManifestRepository
.getBaseByManufacturerModel(dv.getHw().getManufacturer(), .getBaseByManufacturerModel(dv.getHw().getManufacturer(),
dv.getHw().getProductName()); dv.getHw().getProductName());
measurements = temp; integrityMeasurements = deviceLiveLog;
measurements.setPlatformManufacturer(dv.getHw().getManufacturer()); integrityMeasurements.setPlatformManufacturer(dv.getHw().getManufacturer());
measurements.setPlatformModel(dv.getHw().getProductName()); integrityMeasurements.setPlatformModel(dv.getHw().getProductName());
if (tagId != null && !tagId.trim().isEmpty()) { if (tagId != null && !tagId.trim().isEmpty()) {
measurements.setTagId(tagId); integrityMeasurements.setTagId(tagId);
} }
measurements.setDeviceName(dv.getNw().getHostname()); integrityMeasurements.setDeviceName(dv.getNw().getHostname());
measurements.archive(); integrityMeasurements.archive();
this.referenceManifestRepository.save(measurements); this.referenceManifestRepository.save(integrityMeasurements);
for (BaseReferenceManifest bRim : baseRims) { for (BaseReferenceManifest bRim : baseRims) {
if (bRim != null) { if (bRim != null) {
@ -573,8 +573,8 @@ public class IdentityClaimProcessor extends AbstractProcessor {
// event log hash for use during provision // event log hash for use during provision
SupportReferenceManifest sBaseRim = referenceManifestRepository SupportReferenceManifest sBaseRim = referenceManifestRepository
.getSupportRimEntityById(bRim.getAssociatedRim()); .getSupportRimEntityById(bRim.getAssociatedRim());
bRim.setEventLogHash(temp.getHexDecHash()); bRim.setEventLogHash(deviceLiveLog.getHexDecHash());
sBaseRim.setEventLogHash(temp.getHexDecHash()); sBaseRim.setEventLogHash(deviceLiveLog.getHexDecHash());
referenceManifestRepository.save(bRim); referenceManifestRepository.save(bRim);
referenceManifestRepository.save(sBaseRim); referenceManifestRepository.save(sBaseRim);
} }