Search in sources :

Example 1 with PaaSNotYetDeployedException

use of alien4cloud.paas.exception.PaaSNotYetDeployedException in project alien4cloud by alien4cloud.

the class AbstractPaaSProvider method undeploy.

@Override
public void undeploy(PaaSDeploymentContext deploymentContext, IPaaSCallback<?> callback) {
    String deploymentId = deploymentContext.getDeploymentPaaSId();
    try {
        providerLock.writeLock().lock();
        DeploymentStatus deploymentStatus = getStatus(deploymentId, true);
        switch(deploymentStatus) {
            case UNDEPLOYMENT_IN_PROGRESS:
            case UNDEPLOYED:
                throw new PaaSNotYetDeployedException("Application [" + deploymentId + "] is in status [" + deploymentStatus + "] and cannot be undeployed");
            case UNKNOWN:
                throw new IllegalDeploymentStateException("Application [" + deploymentId + "] is in status [" + deploymentStatus + "] and cannot be undeployed");
            case DEPLOYMENT_IN_PROGRESS:
            case FAILURE:
            case DEPLOYED:
            case WARNING:
                doUndeploy(deploymentContext);
                callback.onSuccess(null);
                break;
            default:
                throw new IllegalDeploymentStateException("Application [" + deploymentId + "] is in illegal status [" + deploymentStatus + "] and cannot be undeployed");
        }
    } finally {
        providerLock.writeLock().unlock();
    }
}
Also used : PaaSNotYetDeployedException(alien4cloud.paas.exception.PaaSNotYetDeployedException) IllegalDeploymentStateException(alien4cloud.paas.exception.IllegalDeploymentStateException) DeploymentStatus(alien4cloud.paas.model.DeploymentStatus)

Aggregations

IllegalDeploymentStateException (alien4cloud.paas.exception.IllegalDeploymentStateException)1 PaaSNotYetDeployedException (alien4cloud.paas.exception.PaaSNotYetDeployedException)1 DeploymentStatus (alien4cloud.paas.model.DeploymentStatus)1