Search in sources :

Example 1 with AmbariStopServerAndAgentRequest

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

the class AmbariStopServerAndAgentHandler method accept.

@Override
public void accept(Event<AmbariStopServerAndAgentRequest> event) {
    AmbariStopServerAndAgentRequest request = event.getData();
    Long stackId = request.getResourceId();
    AmbariStopServerAndAgentResult result;
    try {
        Stack stack = stackService.getByIdWithListsInTransaction(stackId);
        GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
        Set<Node> allNodes = stackUtil.collectNodes(stack);
        hostOrchestrator.stopClusterManagerOnMaster(primaryGatewayConfig, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
        result = new AmbariStopServerAndAgentResult(request);
    } catch (Exception e) {
        String message = "Failed to start ambari agent and/or server on new host.";
        LOGGER.error(message, e);
        result = new AmbariStopServerAndAgentResult(message, e, request);
    }
    eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) AmbariStopServerAndAgentRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.AmbariStopServerAndAgentRequest) AmbariStopServerAndAgentResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.AmbariStopServerAndAgentResult) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Aggregations

Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)1 AmbariStopServerAndAgentRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.AmbariStopServerAndAgentRequest)1 AmbariStopServerAndAgentResult (com.sequenceiq.cloudbreak.reactor.api.event.cluster.AmbariStopServerAndAgentResult)1