Search in sources :

Example 1 with ClusterUpgradeFreeIpaStatusValidationEvent

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);
        }
    };
}
Also used : ClusterUpgradeFreeIpaStatusValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent) Optional(java.util.Optional) StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent) Map(java.util.Map) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) ClusterUpgradeValidationFailureEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFailureEvent) ClusterUpgradeUpdateCheckFailedToClusterUpgradeValidationFailureEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.config.ClusterUpgradeUpdateCheckFailedToClusterUpgradeValidationFailureEvent) Bean(org.springframework.context.annotation.Bean)

Example 2 with ClusterUpgradeFreeIpaStatusValidationEvent

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);
    }
}
Also used : ClusterUpgradeFreeIpaStatusValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent) ClusterUpgradeFreeIpaStatusValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent) ClusterUpgradeValidationFailureEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFailureEvent) UpgradeValidationFailedException(com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)

Example 3 with ClusterUpgradeFreeIpaStatusValidationEvent

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;
}
Also used : ClusterUpgradeFreeIpaStatusValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent)

Aggregations

ClusterUpgradeFreeIpaStatusValidationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent)3 ClusterUpgradeValidationFailureEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFailureEvent)2 UpgradeValidationFailedException (com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)1 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 ClusterUpgradeUpdateCheckFailedToClusterUpgradeValidationFailureEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.config.ClusterUpgradeUpdateCheckFailedToClusterUpgradeValidationFailureEvent)1 ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeExistingUpgradeCommandValidationFinishedEvent)1 ClusterUpgradeFreeIpaStatusValidationFinishedEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent)1 StackContext (com.sequenceiq.cloudbreak.core.flow2.stack.StackContext)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bean (org.springframework.context.annotation.Bean)1