Search in sources :

Example 1 with ClusterUpgradeFreeIpaStatusValidationFinishedEvent

use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent 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 2 with ClusterUpgradeFreeIpaStatusValidationFinishedEvent

use of com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent 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);
        }
    };
}
Also used : Optional(java.util.Optional) StackContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackContext) ClusterUpgradeValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFinishedEvent) ClusterUpgradeFreeIpaStatusValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent) ClusterUpgradeServiceValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeServiceValidationEvent) Map(java.util.Map) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) Bean(org.springframework.context.annotation.Bean)

Aggregations

ClusterUpgradeFreeIpaStatusValidationFinishedEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationFinishedEvent)2 UpgradeValidationFailedException (com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)1 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 ClusterUpgradeFreeIpaStatusValidationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeFreeIpaStatusValidationEvent)1 ClusterUpgradeServiceValidationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeServiceValidationEvent)1 ClusterUpgradeValidationFailureEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFailureEvent)1 ClusterUpgradeValidationFinishedEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFinishedEvent)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