use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeServiceValidationEvent in project cloudbreak by hortonworks.
the class ClusterUpgradeValidationActions method clusterUpgradeServiceValidation.
@Bean(name = "CLUSTER_UPGRADE_SERVICE_VALIDATION_STATE")
public Action<?, ?> clusterUpgradeServiceValidation() {
return new AbstractClusterUpgradeValidationAction<>(ClusterUpgradeFreeIpaStatusValidationFinishedEvent.class) {
@Override
protected void doExecute(StackContext context, ClusterUpgradeFreeIpaStatusValidationFinishedEvent payload, Map<Object, Object> variables) {
LOGGER.info("Starting to validate services.");
boolean lockComponents = (Boolean) variables.get(LOCK_COMPONENTS);
ClusterUpgradeServiceValidationEvent event = new ClusterUpgradeServiceValidationEvent(payload.getResourceId(), lockComponents);
sendEvent(context, event.selector(), event);
}
@Override
protected Object getFailurePayload(ClusterUpgradeFreeIpaStatusValidationFinishedEvent payload, Optional<StackContext> flowContext, Exception ex) {
return new ClusterUpgradeValidationFinishedEvent(payload.getResourceId(), ex);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeServiceValidationEvent in project cloudbreak by hortonworks.
the class ClusterUpgradeServiceValidationHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<ClusterUpgradeServiceValidationEvent> event) {
LOGGER.debug("Accepting Cluster upgrade service validation event.");
ClusterUpgradeServiceValidationEvent request = event.getData();
Long stackId = request.getResourceId();
try {
Stack stack = getStack(stackId);
serviceUpgradeValidators.forEach(validator -> validator.validate(new ServiceUpgradeValidationRequest(stack, request.isLockComponents())));
return new ClusterUpgradeValidationFinishedEvent(stackId);
} catch (UpgradeValidationFailedException e) {
LOGGER.warn("Cluster upgrade service validation failed", e);
return new ClusterUpgradeValidationFailureEvent(stackId, e);
} catch (Exception e) {
LOGGER.error("Cluster upgrade service validation was unsuccessful due to an internal error", e);
return new ClusterUpgradeValidationFinishedEvent(stackId, e);
}
}
Aggregations