use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.certrenew.ClusterCertificateReissueRequest 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));
}
Aggregations