use of com.sequenceiq.cloudbreak.reactor.api.event.stack.loadbalancer.UpdateServiceConfigSuccess in project cloudbreak by hortonworks.
the class UpdateServiceConfigHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UpdateServiceConfigRequest> event) {
UpdateServiceConfigRequest request = event.getData();
Stack stack = request.getStack();
requireNonNull(stack);
requireNonNull(stack.getCluster());
try {
LOGGER.debug("Gathering entries for Hue knox_proxyhosts property.");
Set<String> proxyhosts = new HashSet<>();
if (StringUtils.isNotEmpty(stack.getPrimaryGatewayInstance().getDiscoveryFQDN())) {
proxyhosts.add(stack.getPrimaryGatewayInstance().getDiscoveryFQDN());
}
if (StringUtils.isNotEmpty(stack.getPrimaryGatewayInstance().getDiscoveryFQDN())) {
proxyhosts.add(stack.getCluster().getFqdn());
}
String loadBalancerFqdn = loadBalancerConfigService.getLoadBalancerUserFacingFQDN(stack.getId());
if (StringUtils.isNotEmpty(loadBalancerFqdn)) {
proxyhosts.add(loadBalancerFqdn);
}
LOGGER.debug("Hue knox_proxyhosts setting will be updated to {}", proxyhosts);
ClusterApi clusterApi = clusterApiConnectors.getConnector(stackService.getByIdWithListsInTransaction(event.getData().getResourceId()));
clusterApi.clusterModificationService().updateServiceConfigAndRestartService(HUE_SERVICE, HUE_KNOX_PROXYHOSTS, String.join(",", proxyhosts));
LOGGER.debug("Updating CM frontend URL with load balancer DNS");
clusterHostServiceRunner.updateClusterConfigs(stack, stack.getCluster());
LOGGER.debug("Service config update was successful");
return new UpdateServiceConfigSuccess(stack);
} catch (Exception e) {
LOGGER.warn("Error updating HUE and CM service configuration.", e);
return new UpdateServiceConfigFailure(request.getResourceId(), e);
}
}
use of com.sequenceiq.cloudbreak.reactor.api.event.stack.loadbalancer.UpdateServiceConfigSuccess in project cloudbreak by hortonworks.
the class StackLoadBalancerUpdateActions method restartCmAction.
@Bean(name = "RESTARTING_CM_STATE")
public Action<?, ?> restartCmAction() {
return new AbstractStackLoadBalancerUpdateAction<>(UpdateServiceConfigSuccess.class) {
@Override
protected void doExecute(StackContext context, UpdateServiceConfigSuccess payload, Map<Object, Object> variables) {
stackLoadBalancerUpdateService.restartingCm(context.getStack());
StackContext newContext = new StackContext(context.getFlowParameters(), payload.getStack(), context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackContext context) {
return new RestartCmForLbRequest(context.getStack());
}
};
}
Aggregations