Search in sources :

Example 1 with ClusterCertificateRenewFailed

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRenewFailed in project cloudbreak by hortonworks.

the class ClusterCertificateRedeployHandler method accept.

@Override
public void accept(Event<ClusterCertificateRedeployRequest> event) {
    ClusterCertificateRedeployRequest data = event.getData();
    Long stackId = data.getResourceId();
    LOGGER.debug("Redeploy certificate for stack 'id:{}'", stackId);
    Selectable response;
    try {
        clusterServiceRunner.redeployGatewayCertificate(stackId);
        LOGGER.info("Certificate of the cluster has been redeployed successfully.");
        response = new ClusterCertificateRedeploySuccess(stackId);
    } catch (Exception ex) {
        String msg = "Certificate couldn't be redeployed to the cluster: ";
        LOGGER.warn(msg, ex);
        response = new ClusterCertificateRenewFailed(stackId, new CloudbreakOrchestratorFailedException(msg + ex.getMessage(), ex));
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : ClusterCertificateRedeployRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRedeployRequest) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ClusterCertificateRenewFailed(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRenewFailed) ClusterCertificateRedeploySuccess(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRedeploySuccess) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)

Example 2 with ClusterCertificateRenewFailed

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRenewFailed in project cloudbreak by hortonworks.

the class ClusterCertificateReissueHandler method accept.

@Override
public void accept(Event<ClusterCertificateReissueRequest> event) {
    ClusterCertificateReissueRequest data = event.getData();
    Long stackId = data.getResourceId();
    LOGGER.debug("Reissue certificate for stack 'id:{}'", stackId);
    Selectable response;
    try {
        boolean certReissued = reissueCertificate(stackId);
        if (certReissued) {
            LOGGER.info("Certificate of the cluster has been reissued successfully.");
            response = new ClusterCertificateReissueSuccess(stackId);
        } else {
            LOGGER.warn("The certificate of the cluster could not be reissued via PEM service.");
            response = new ClusterCertificateRenewFailed(stackId, new IllegalStateException("The certificate of the cluster could not be reissued."));
        }
    } catch (Exception ex) {
        LOGGER.warn("Reissue of certificate has been failed for cluster", ex);
        response = new ClusterCertificateRenewFailed(stackId, ex);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ClusterCertificateReissueRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateReissueRequest) ClusterCertificateRenewFailed(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRenewFailed) ClusterCertificateReissueSuccess(com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateReissueSuccess)

Aggregations

Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)2 ClusterCertificateRenewFailed (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRenewFailed)2 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 ClusterCertificateRedeployRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRedeployRequest)1 ClusterCertificateRedeploySuccess (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateRedeploySuccess)1 ClusterCertificateReissueRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateReissueRequest)1 ClusterCertificateReissueSuccess (com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateReissueSuccess)1