Search in sources :

Example 1 with FlowTriggerConditionResult

use of com.sequenceiq.flow.core.FlowTriggerConditionResult in project cloudbreak by hortonworks.

the class StackStopFlowTriggerCondition method isFlowTriggerable.

@Override
public FlowTriggerConditionResult isFlowTriggerable(Long stackId) {
    FlowTriggerConditionResult result = FlowTriggerConditionResult.OK;
    StackView stack = stackService.getViewByIdWithoutAuth(stackId);
    if (!stackStartStopService.isStopPossible(stack)) {
        String msg = "Stopping stack is not possible because stack is not in stop requested state.";
        LOGGER.debug(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    return result;
}
Also used : StackView(com.sequenceiq.cloudbreak.domain.view.StackView) FlowTriggerConditionResult(com.sequenceiq.flow.core.FlowTriggerConditionResult)

Example 2 with FlowTriggerConditionResult

use of com.sequenceiq.flow.core.FlowTriggerConditionResult in project cloudbreak by hortonworks.

the class ClusterCreationFlowTriggerCondition method isFlowTriggerable.

@Override
public FlowTriggerConditionResult isFlowTriggerable(Long stackId) {
    FlowTriggerConditionResult result = FlowTriggerConditionResult.OK;
    StackView stackView = stackService.getViewByIdWithoutAuth(stackId);
    boolean triggerable = stackView.isCreateInProgress();
    if (!triggerable) {
        String msg = "Cluster creation cannot be triggered, because stack is not in create in progress status.";
        LOGGER.warn(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    return result;
}
Also used : StackView(com.sequenceiq.cloudbreak.domain.view.StackView) FlowTriggerConditionResult(com.sequenceiq.flow.core.FlowTriggerConditionResult)

Example 3 with FlowTriggerConditionResult

use of com.sequenceiq.flow.core.FlowTriggerConditionResult in project cloudbreak by hortonworks.

the class ClusterCertificateRenewTriggerCondition method isFlowTriggerable.

@Override
public FlowTriggerConditionResult isFlowTriggerable(Long stackId) {
    FlowTriggerConditionResult result = FlowTriggerConditionResult.OK;
    Stack stack = stackService.getByIdWithTransaction(stackId);
    boolean resourcesIsInTriggerableState = stack.isAvailable() && stack.getCluster() != null;
    if (!resourcesIsInTriggerableState) {
        String msg = "Certificate renewal could not be triggered, because the cluster's state is not available.";
        LOGGER.info(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    boolean certRenewalIsTriggerable = gatewayPublicEndpointManagementService.isCertRenewalTriggerable(stack);
    if (!certRenewalIsTriggerable) {
        String msg = "Certificate renewal could not be triggered, because the generation feature is disabled or certificate that" + " is generated by PEM service does not belong to the specified stack.";
        LOGGER.info(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    return result;
}
Also used : FlowTriggerConditionResult(com.sequenceiq.flow.core.FlowTriggerConditionResult) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 4 with FlowTriggerConditionResult

use of com.sequenceiq.flow.core.FlowTriggerConditionResult in project cloudbreak by hortonworks.

the class StackImageUpdateFlowTriggerCondition method isFlowTriggerable.

@Override
public FlowTriggerConditionResult isFlowTriggerable(Long stackId) {
    FlowTriggerConditionResult result = FlowTriggerConditionResult.OK;
    StackView stackView = stackService.getViewByIdWithoutAuth(stackId);
    boolean triggerable = stackView.isAvailable();
    if (!triggerable) {
        String msg = "Image update cannot be triggered because the cluster is not available.";
        LOGGER.debug(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    return result;
}
Also used : StackView(com.sequenceiq.cloudbreak.domain.view.StackView) FlowTriggerConditionResult(com.sequenceiq.flow.core.FlowTriggerConditionResult)

Example 5 with FlowTriggerConditionResult

use of com.sequenceiq.flow.core.FlowTriggerConditionResult in project cloudbreak by hortonworks.

the class InstanceTerminationFlowTriggerCondition method isFlowTriggerable.

@Override
public FlowTriggerConditionResult isFlowTriggerable(Long stackId) {
    FlowTriggerConditionResult result = FlowTriggerConditionResult.OK;
    StackView stack = stackService.getViewByIdWithoutAuth(stackId);
    if (stack.isDeleteInProgress()) {
        String msg = "Couldn't start instance termination flow because the stack has been terminating.";
        LOGGER.debug(msg);
        result = new FlowTriggerConditionResult(msg);
    }
    return result;
}
Also used : StackView(com.sequenceiq.cloudbreak.domain.view.StackView) FlowTriggerConditionResult(com.sequenceiq.flow.core.FlowTriggerConditionResult)

Aggregations

FlowTriggerConditionResult (com.sequenceiq.flow.core.FlowTriggerConditionResult)10 StackView (com.sequenceiq.cloudbreak.domain.view.StackView)5 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)1 ClusterView (com.sequenceiq.cloudbreak.domain.view.ClusterView)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 NestedSleepChainTriggerEvent (com.sequenceiq.flow.component.sleep.event.NestedSleepChainTriggerEvent)1 SleepChainTriggerEvent (com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent)1 SleepConfig (com.sequenceiq.flow.component.sleep.event.SleepConfig)1 FlowAcceptResult (com.sequenceiq.flow.core.model.FlowAcceptResult)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 Test (org.junit.jupiter.api.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1