Search in sources :

Example 6 with CheckResult

use of com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult in project cloudbreak by hortonworks.

the class FreeIpaInstanceHealthDetailsService method createRpcMessageFromCheckResult.

private RPCMessage createRpcMessageFromCheckResult(RPCResponse<CheckResult> nodeHealth) {
    List<CheckEntry> checkEntries = filterCheckEntries(nodeHealth);
    List<PluginStatusEntry> pluginStatusEntries = filterPluginStatusEntries(nodeHealth);
    CheckResult filteredCheckResult = new CheckResult();
    filteredCheckResult.setChecks(checkEntries);
    filteredCheckResult.setPluginStats(pluginStatusEntries);
    if (nodeHealth.getResult() != null) {
        filteredCheckResult.setStatus(nodeHealth.getResult().getStatus());
        filteredCheckResult.setHost(nodeHealth.getResult().getHost());
    }
    RPCMessage rpcMessage = new RPCMessage();
    rpcMessage.setName("node health check");
    rpcMessage.setMessage(JsonUtil.writeValueAsStringSilent(filteredCheckResult));
    if (nodeHealth.getFirstRpcMessage() != null) {
        rpcMessage.setCode(nodeHealth.getFirstRpcMessage().getCode());
    }
    return rpcMessage;
}
Also used : CheckEntry(com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry) PluginStatusEntry(com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry) CheckResult(com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Aggregations

CheckResult (com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult)6 RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)4 CheckEntry (com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry)2 PluginStatusEntry (com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry)2 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)1 FreeIpaHealthCheckClient (com.sequenceiq.freeipa.client.FreeIpaHealthCheckClient)1 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 SpiDto (com.sequenceiq.mock.spi.SpiDto)1 Test (org.junit.jupiter.api.Test)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1