use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent in project cloudbreak by hortonworks.
the class ClusterUpgradeValidationActions method clusterUpgradeFreeIpaStatusValidation.
@Bean(name = "CLUSTER_UPGRADE_FREEIPA_STATUS_VALIDATION_STATE")
public Action<?, ?> clusterUpgradeFreeIpaStatusValidation() {
return new AbstractClusterUpgradeValidationAction<>(ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent.class) {
@Override
protected void doExecute(StackContext context, ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent payload, Map<Object, Object> variables) {
LOGGER.info("Starting the validation if FreeIPA is reachable...");
ClusterUpgradeFreeIpaStatusValidationEvent event = new ClusterUpgradeFreeIpaStatusValidationEvent(payload.getResourceId());
sendEvent(context, event.selector(), event);
}
@Override
protected Object getFailurePayload(ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent payload, Optional<StackContext> flowContext, Exception ex) {
return new ClusterUpgradeValidationFailureEvent(payload.getResourceId(), ex);
}
};
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent in project cloudbreak by hortonworks.
the class ClusterUpgradeFreeIpaStatusValidationHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<ClusterUpgradeFreeIpaStatusValidationEvent> event) {
LOGGER.debug("Accepting Cluster upgrade FreeIPA status validation event.");
ClusterUpgradeFreeIpaStatusValidationEvent request = event.getData();
Long stackId = request.getResourceId();
String environmentCrn = getStack(stackId).getEnvironmentCrn();
if (!freeipaService.checkFreeipaRunning(environmentCrn)) {
String message = "Upgrade cannot be performed because the FreeIPA isn't available. Please check the FreeIPA state and try again.";
LOGGER.info("FreeIPA status validation failed with: {}", message);
return new ClusterUpgradeValidationFailureEvent(stackId, new UpgradeValidationFailedException(message));
} else {
LOGGER.debug("FreeIPA status validation passed successfully");
return new ClusterUpgradeFreeIpaStatusValidationFinishedEvent(stackId);
}
}
use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent in project cloudbreak by hortonworks.
the class ClusterUpgradeFreeIpaStatusValidationHandlerTest method getHandlerEvent.
private HandlerEvent<ClusterUpgradeFreeIpaStatusValidationEvent> getHandlerEvent() {
ClusterUpgradeFreeIpaStatusValidationEvent clusterUpgradeImageValidationEvent = new ClusterUpgradeFreeIpaStatusValidationEvent(1L);
HandlerEvent<ClusterUpgradeFreeIpaStatusValidationEvent> handlerEvent = mock(HandlerEvent.class);
when(handlerEvent.getData()).thenReturn(clusterUpgradeImageValidationEvent);
return handlerEvent;
}
Aggregations