use of com.intel.mtwilson.as.controller.TblTaLogJpaController in project OpenAttestation by OpenAttestation.
the class HostBO method deleteTALogs.
private void deleteTALogs(Integer hostId) throws IllegalOrphanException {
TblTaLogJpaController tblTaLogJpaController = getTaLogJpaController();
List<TblTaLog> taLogs = tblTaLogJpaController.findLogsByHostId(hostId, new Date());
if (taLogs != null) {
for (TblTaLog taLog : taLogs) {
try {
tblTaLogJpaController.destroy(taLog.getId());
} catch (NonexistentEntityException e) {
log.warn("Ta Log is already deleted " + taLog.getId());
}
}
log.info("Deleted all the logs for the given host " + hostId);
}
}
use of com.intel.mtwilson.as.controller.TblTaLogJpaController in project OpenAttestation by OpenAttestation.
the class HostTrustBO method logBlankTrustStatus.
/*Bug 510
* Added to support removal of TPM from host which was previously enabled.
* Adding blank row to ta log table will prevent an invalid trust report
*/
private void logBlankTrustStatus(TblHosts host) {
Date today = new Date(System.currentTimeMillis());
TblTaLog taLog = new TblTaLog();
taLog.setHostID(host.getId());
taLog.setMleId(0);
taLog.setTrustStatus(false);
taLog.setManifestName("");
taLog.setManifestValue("");
taLog.setUpdatedOn(today);
new TblTaLogJpaController(getEntityManagerFactory()).create(taLog);
}
use of com.intel.mtwilson.as.controller.TblTaLogJpaController in project OpenAttestation by OpenAttestation.
the class HostTrustBO method getTrustWithCache.
public HostTrust getTrustWithCache(String host, Boolean forceVerify) {
log.info("Getting trust for host: " + host + " Force verify flag: " + forceVerify);
try {
if (forceVerify != true) {
TblHosts tblHosts = getHostByName(new Hostname(host));
if (tblHosts != null) {
TblTaLog tblTaLog = new TblTaLogJpaController(getEntityManagerFactory()).getHostTALogEntryBefore(tblHosts.getId(), getCacheStaleAfter());
if (tblTaLog != null)
return getHostTrustObj(tblTaLog);
} else {
throw new ASException(ErrorCode.AS_HOST_NOT_FOUND, host);
}
}
log.info("Getting trust status from host.");
HostTrustStatus status = getTrustStatus(new Hostname(host));
HostTrust hostTrust = new HostTrust(ErrorCode.OK, "OK");
hostTrust.setBiosStatus((status.bios) ? 1 : 0);
hostTrust.setVmmStatus((status.vmm) ? 1 : 0);
hostTrust.setIpAddress(host);
return hostTrust;
} catch (ASException e) {
log.error("Error while getting trust for host " + host, e);
return new HostTrust(e.getErrorCode(), e.getErrorMessage(), host, null, null);
} catch (Exception e) {
log.error("Error while getting trust for host " + host, e);
return new HostTrust(ErrorCode.SYSTEM_ERROR, new AuthResponse(ErrorCode.SYSTEM_ERROR, e.getMessage()).getErrorMessage(), host, null, null);
}
}
Aggregations