Search in sources :

Example 1 with ClusterUpgradeValidationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent in project cloudbreak by hortonworks.

the class UpgradeDatalakeFlowEventChainFactory method addUpgradeValidationToChain.

private void addUpgradeValidationToChain(ClusterUpgradeTriggerEvent event, Queue<Selectable> flowEventChain) {
    if (upgradeValidationEnabled) {
        Stack stack = stackService.getById(event.getResourceId());
        boolean lockComponents = lockedComponentService.isComponentsLocked(stack, event.getImageId());
        flowEventChain.add(new ClusterUpgradeValidationTriggerEvent(event.getResourceId(), event.accepted(), event.getImageId(), lockComponents));
    }
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) ClusterUpgradeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent)

Example 2 with ClusterUpgradeValidationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent in project cloudbreak by hortonworks.

the class UpgradeDistroxFlowEventChainFactoryTest method assertUpdateValidationEvent.

private void assertUpdateValidationEvent(FlowTriggerEventQueue flowChainQueue) {
    Selectable upgradeValidationEvent = flowChainQueue.getQueue().remove();
    assertEquals(START_CLUSTER_UPGRADE_VALIDATION_INIT_EVENT.event(), upgradeValidationEvent.selector());
    assertEquals(STACK_ID, upgradeValidationEvent.getResourceId());
    assertTrue(upgradeValidationEvent instanceof ClusterUpgradeValidationTriggerEvent);
    assertEquals(imageChangeDto.getImageId(), ((ClusterUpgradeValidationTriggerEvent) upgradeValidationEvent).getImageId());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ClusterUpgradeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent)

Example 3 with ClusterUpgradeValidationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent in project cloudbreak by hortonworks.

the class ClusterUpgradeValidationActions method initClusterUpgradeValidation.

@Bean(name = "CLUSTER_UPGRADE_VALIDATION_INIT_STATE")
public Action<?, ?> initClusterUpgradeValidation() {
    return new AbstractClusterUpgradeValidationAction<>(ClusterUpgradeValidationTriggerEvent.class) {

        @Override
        protected void doExecute(StackContext context, ClusterUpgradeValidationTriggerEvent payload, Map<Object, Object> variables) {
            LOGGER.info("Starting cluster upgrade validation flow. Target image: {}", payload.getImageId());
            cloudbreakEventService.fireCloudbreakEvent(payload.getResourceId(), UPDATE_IN_PROGRESS.name(), ResourceEvent.CLUSTER_UPGRADE_VALIDATION_STARTED);
            variables.put(LOCK_COMPONENTS, payload.isLockComponents());
            ClusterUpgradeValidationEvent event = new ClusterUpgradeValidationEvent(START_CLUSTER_UPGRADE_IMAGE_VALIDATION_EVENT.name(), payload.getResourceId(), payload.getImageId());
            sendEvent(context, event.selector(), event);
        }

        @Override
        protected Object getFailurePayload(ClusterUpgradeValidationTriggerEvent payload, Optional<StackContext> flowContext, Exception ex) {
            return new ClusterUpgradeValidationFinishedEvent(payload.getResourceId(), ex);
        }
    };
}
Also used : ClusterUpgradeValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationEvent) Optional(java.util.Optional) StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) ClusterUpgradeValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFinishedEvent) Map(java.util.Map) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) ClusterUpgradeValidationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent) Bean(org.springframework.context.annotation.Bean)

Aggregations

ClusterUpgradeValidationTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationTriggerEvent)3 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 ClusterUpgradeValidationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationEvent)1 ClusterUpgradeValidationFinishedEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFinishedEvent)1 StackContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackContext)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bean (org.springframework.context.annotation.Bean)1