Search in sources :

Example 16 with UpgradeCcmEvent

use of com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmTunnelUpdateHandler method accept.

@Override
public void accept(Event<EnvironmentDto> environmentDtoEvent) {
    LOGGER.debug("In UpgradeCcmTunnelUpdateHandler.accept");
    EnvironmentDto environmentDto = environmentDtoEvent.getData();
    try {
        environmentService.updateTunnelByEnvironmentId(environmentDto.getResourceId(), Tunnel.latestUpgradeTarget());
        UpgradeCcmEvent upgradeCcmEvent = UpgradeCcmEvent.builder().withSelector(UpgradeCcmStateSelectors.UPGRADE_CCM_DATALAKE_EVENT.selector()).withResourceCrn(environmentDto.getResourceCrn()).withResourceId(environmentDto.getId()).withResourceName(environmentDto.getName()).build();
        eventSender().sendEvent(upgradeCcmEvent, environmentDtoEvent.getHeaders());
        LOGGER.debug("UPGRADE_CCM_DATALAKE_EVENT event sent");
    } catch (Exception e) {
        UpgradeCcmFailedEvent failedEvent = new UpgradeCcmFailedEvent(environmentDto, e, EnvironmentStatus.UPGRADE_CCM_TUNNEL_UPDATE_FAILED);
        eventSender().sendEvent(failedEvent, environmentDtoEvent.getHeaders());
        LOGGER.debug("UPGRADE_CCM_TUNNEL_UPDATE_FAILED event sent");
    }
}
Also used : UpgradeCcmEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent) UpgradeCcmFailedEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto)

Example 17 with UpgradeCcmEvent

use of com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class EnvironmentReactorFlowManager method triggerCcmUpgradeFlow.

public FlowIdentifier triggerCcmUpgradeFlow(EnvironmentDto environment, String userCrn) {
    LOGGER.info("Environment CCM upgrade flow triggered for environment {}", environment.getName());
    UpgradeCcmEvent upgradeCcmEvent = UpgradeCcmEvent.builder().withAccepted(new Promise<>()).withResourceCrn(environment.getResourceCrn()).withResourceId(environment.getId()).withResourceName(environment.getName()).withSelector(UpgradeCcmStateSelectors.UPGRADE_CCM_VALIDATION_EVENT.selector()).build();
    FlowIdentifier flowIdentifier = eventSender.sendEvent(upgradeCcmEvent, new Event.Headers(getFlowTriggerUsercrn(userCrn)));
    LOGGER.debug("Environment CCM upgrade flow trigger event sent for environment {}", environment.getName());
    return flowIdentifier;
}
Also used : UpgradeCcmEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent) Promise(reactor.rx.Promise) EnvStackConfigUpdatesEvent(com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent) EnvCreationEvent(com.sequenceiq.environment.environment.flow.creation.event.EnvCreationEvent) Event(reactor.bus.Event) EnvStopEvent(com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent) EnvStartEvent(com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent) LoadBalancerUpdateEvent(com.sequenceiq.environment.environment.flow.loadbalancer.event.LoadBalancerUpdateEvent) UpgradeCcmEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent) EnvDeleteEvent(com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier)

Aggregations

UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)17 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)11 CommonContext (com.sequenceiq.flow.core.CommonContext)6 Map (java.util.Map)6 Bean (org.springframework.context.annotation.Bean)6 UpgradeCcmFailedEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent)4 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)3 SdxCcmUpgradeResponse (com.sequenceiq.sdx.api.model.SdxCcmUpgradeResponse)3 Test (org.junit.jupiter.api.Test)3 OperationException (com.sequenceiq.cloudbreak.service.OperationException)1 EnvStackConfigUpdatesEvent (com.sequenceiq.environment.environment.flow.config.update.event.EnvStackConfigUpdatesEvent)1 EnvCreationEvent (com.sequenceiq.environment.environment.flow.creation.event.EnvCreationEvent)1 EnvDeleteEvent (com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent)1 LoadBalancerUpdateEvent (com.sequenceiq.environment.environment.flow.loadbalancer.event.LoadBalancerUpdateEvent)1 EnvStartEvent (com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent)1 EnvStopEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent)1 FreeIpaOperationFailedException (com.sequenceiq.environment.exception.FreeIpaOperationFailedException)1 FlowParameters (com.sequenceiq.flow.core.FlowParameters)1 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1