Search in sources :

Example 1 with UpgradeCcmFailedEvent

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent in project cloudbreak by hortonworks.

the class ReconfigureNginxHandler method doAccept.

@Override
public Selectable doAccept(HandlerEvent<UpgradeCcmReconfigureNginxRequest> event) {
    UpgradeCcmReconfigureNginxRequest request = event.getData();
    Long stackId = request.getResourceId();
    LOGGER.info("NGINX reconfiguration is needed for previous CCM tunnel type");
    try {
        upgradeCcmService.reconfigureNginx(stackId);
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.debug("Failed reconfiguring NGINX with salt state");
        return new UpgradeCcmFailedEvent(stackId, request.getOldTunnel(), e);
    }
    return new UpgradeCcmReconfigureNginxResult(stackId, request.getClusterId(), request.getOldTunnel());
}
Also used : CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UpgradeCcmReconfigureNginxRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxRequest) UpgradeCcmFailedEvent(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent) UpgradeCcmReconfigureNginxResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxResult)

Example 2 with UpgradeCcmFailedEvent

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent in project cloudbreak by hortonworks.

the class RemoveAgentHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<UpgradeCcmRemoveAgentRequest> event) {
    UpgradeCcmRemoveAgentRequest request = event.getData();
    Long stackId = request.getResourceId();
    LOGGER.info("Remove agent for CCM upgrade...");
    try {
        upgradeCcmService.removeAgent(stackId, request.getOldTunnel());
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.debug("Failed removing agent with a salt state");
        return new UpgradeCcmFailedEvent(stackId, request.getOldTunnel(), e);
    }
    return new UpgradeCcmRemoveAgentResult(stackId, request.getClusterId(), request.getOldTunnel());
}
Also used : UpgradeCcmRemoveAgentRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UpgradeCcmFailedEvent(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent) UpgradeCcmRemoveAgentResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentResult)

Example 3 with UpgradeCcmFailedEvent

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent in project cloudbreak by hortonworks.

the class UpgradeCcmActions method upgradeCcmFailed.

@Bean(name = "UPGRADE_CCM_FAILED_STATE")
public Action<?, ?> upgradeCcmFailed() {
    return new AbstractStackFailureAction<UpgradeCcmState, UpgradeCcmEvent>() {

        @Override
        protected void doExecute(StackFailureContext context, StackFailureEvent payload, Map<Object, Object> variables) {
            UpgradeCcmFailedEvent concretePayload = (UpgradeCcmFailedEvent) payload;
            upgradeCcmService.ccmUpgradeFailed(concretePayload.getResourceId(), Optional.ofNullable(context.getStackView().getClusterView()).map(ClusterView::getId).orElse(null), concretePayload.getOldTunnel());
            sendEvent(context);
        }

        @Override
        protected Selectable createRequest(StackFailureContext context) {
            return new StackEvent(UpgradeCcmEvent.FAIL_HANDLED_EVENT.event(), context.getStackView().getId());
        }
    };
}
Also used : ClusterView(com.sequenceiq.cloudbreak.domain.view.ClusterView) AbstractStackFailureAction(com.sequenceiq.cloudbreak.core.flow2.stack.AbstractStackFailureAction) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) StackFailureEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent) UpgradeCcmFailedEvent(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent) StackFailureContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackFailureContext) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Aggregations

UpgradeCcmFailedEvent (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent)3 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)2 AbstractStackFailureAction (com.sequenceiq.cloudbreak.core.flow2.stack.AbstractStackFailureAction)1 StackFailureContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackFailureContext)1 ClusterView (com.sequenceiq.cloudbreak.domain.view.ClusterView)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 StackFailureEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent)1 UpgradeCcmReconfigureNginxRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxRequest)1 UpgradeCcmReconfigureNginxResult (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxResult)1 UpgradeCcmRemoveAgentRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest)1 UpgradeCcmRemoveAgentResult (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentResult)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1