Search in sources :

Example 1 with ClusterCertificatesRotationFailed

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterCertificatesRotationFailed in project cloudbreak by hortonworks.

the class ClusterHostCertificatesRotationHandler method doAccept.

protected Selectable doAccept(HandlerEvent<ClusterHostCertificatesRotationRequest> event) {
    LOGGER.debug("Accepting Cluster Manager host certificates rotation request...");
    ClusterHostCertificatesRotationRequest request = event.getData();
    Selectable result;
    try {
        Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
        ClusterApi clusterApi = apiConnectors.getConnector(stack);
        String subAltName = loadBalancerSANProvider.getLoadBalancerSAN(stack).orElse(null);
        if (isRootSshAccessNeededForHostCertRotation(stack)) {
            rotateCertsWithSsh(stack, clusterApi, subAltName);
        } else {
            clusterApi.rotateHostCertificates(null, null, subAltName);
        }
        result = new ClusterHostCertificatesRotationSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.info("Cluster Manager host certificates rotation failed", e);
        result = new ClusterCertificatesRotationFailed(request.getResourceId(), e);
    }
    return result;
}
Also used : ClusterApi(com.sequenceiq.cloudbreak.cluster.api.ClusterApi) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ClusterCertificatesRotationFailed(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterCertificatesRotationFailed) ClusterHostCertificatesRotationSuccess(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterHostCertificatesRotationSuccess) ClusterHostCertificatesRotationRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterHostCertificatesRotationRequest) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

ClusterApi (com.sequenceiq.cloudbreak.cluster.api.ClusterApi)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 ClusterCertificatesRotationFailed (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterCertificatesRotationFailed)1 ClusterHostCertificatesRotationRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterHostCertificatesRotationRequest)1 ClusterHostCertificatesRotationSuccess (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrotate.ClusterHostCertificatesRotationSuccess)1