Search in sources :

Example 11 with UpgradeCcmFailedEvent

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

the class UpgradeCcmOnDatalakeHandler method sendFailedEvent.

private void sendFailedEvent(Event<EnvironmentDto> environmentDtoEvent, EnvironmentDto environmentDto, Exception e) {
    UpgradeCcmFailedEvent failedEvent = new UpgradeCcmFailedEvent(environmentDto, e, EnvironmentStatus.UPGRADE_CCM_ON_DATALAKE_FAILED);
    eventSender().sendEvent(failedEvent, environmentDtoEvent.getHeaders());
    LOGGER.debug("UPGRADE_CCM_ON_DATALAKE_FAILED event sent");
}
Also used : UpgradeCcmFailedEvent(com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent)

Example 12 with UpgradeCcmFailedEvent

use of com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent 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)

Aggregations

UpgradeCcmFailedEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmFailedEvent)12 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)6 UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)4 Test (org.junit.jupiter.api.Test)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 DescribeFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse)2 EnumSource (org.junit.jupiter.params.provider.EnumSource)2 EnvironmentStatus (com.sequenceiq.environment.environment.EnvironmentStatus)1 FreeIpaOperationFailedException (com.sequenceiq.environment.exception.FreeIpaOperationFailedException)1 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)1 CommonContext (com.sequenceiq.flow.core.CommonContext)1 SdxCcmUpgradeResponse (com.sequenceiq.sdx.api.model.SdxCcmUpgradeResponse)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1