Search in sources :

Example 1 with ServiceUpgradeValidationRequest

use of com.sequenceiq.cloudbreak.service.upgrade.validation.service.ServiceUpgradeValidationRequest 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);
    }
}
Also used : ClusterUpgradeValidationFinishedEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFinishedEvent) ClusterUpgradeServiceValidationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeServiceValidationEvent) ServiceUpgradeValidationRequest(com.sequenceiq.cloudbreak.service.upgrade.validation.service.ServiceUpgradeValidationRequest) UpgradeValidationFailedException(com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) UpgradeValidationFailedException(com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException) ClusterUpgradeValidationFailureEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.datalake.upgrade.validation.event.ClusterUpgradeValidationFailureEvent)

Aggregations

UpgradeValidationFailedException (com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)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 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 ServiceUpgradeValidationRequest (com.sequenceiq.cloudbreak.service.upgrade.validation.service.ServiceUpgradeValidationRequest)1