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