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));
}
}
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());
}
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);
}
};
}
Aggregations