use of com.sequenceiq.cloudbreak.common.type.HealthCheckResult in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusService method getCertCheck.
private static Optional<HealthCheck> getCertCheck(ApiHost apiHost) {
Optional<ApiHealthCheck> healthCheck = emptyIfNull(apiHost.getHealthChecks()).stream().filter(health -> HOST_AGENT_CERTIFICATE_EXPIRY.equals(health.getName())).findFirst();
if (healthCheck.isPresent()) {
HealthCheckResult result = ApiHealthSummary.BAD.equals(healthCheck.get().getSummary()) || ApiHealthSummary.CONCERNING.equals(healthCheck.get().getSummary()) ? HealthCheckResult.UNHEALTHY : HealthCheckResult.HEALTHY;
Optional<String> reason = Optional.ofNullable(healthCheck.get().getSummary()).map(apiSum -> "Cert health on CM: " + apiSum.getValue());
return Optional.of(new HealthCheck(HealthCheckType.CERT, result, reason));
}
return Optional.empty();
}
use of com.sequenceiq.cloudbreak.common.type.HealthCheckResult in project cloudbreak by hortonworks.
the class VmStatusCheckerConclusionStepTest method createExtendedHostStatuses.
private ExtendedHostStatuses createExtendedHostStatuses(boolean healthy) {
Map<HostName, Set<HealthCheck>> hostStatuses = new HashMap<>();
HealthCheckResult status = healthy ? HealthCheckResult.HEALTHY : HealthCheckResult.UNHEALTHY;
String reason = healthy ? null : "error";
Set<HealthCheck> healthChecks = Sets.newHashSet(new HealthCheck(HealthCheckType.HOST, status, Optional.ofNullable(reason)));
hostStatuses.put(HostName.hostName("host1"), healthChecks);
hostStatuses.put(HostName.hostName("host2"), healthChecks);
return new ExtendedHostStatuses(hostStatuses);
}
Aggregations