Search in sources :

Example 1 with TaskStatus

use of org.openstack4j.model.image.v2.Task.TaskStatus in project cloudbreak by hortonworks.

the class OpenStackImageImporter method evaluateTaskStatus.

private void evaluateTaskStatus(Task task, String name) {
    if (task != null) {
        TaskStatus status = task.getStatus();
        LOGGER.info("Task status: {}", status);
        if (status == null) {
            throw new CloudConnectorException(String.format("Import of %s did not return any status, message: %s", name, task.getMessage()));
        } else if (status == TaskStatus.FAILURE || status == TaskStatus.UNKNOWN) {
            throw new CloudConnectorException(String.format("Import of %s failed with status: %s, message: %s", name, status, task.getMessage()));
        }
    } else {
        throw new CloudConnectorException(String.format("Import of %s did not return any task or status object", name));
    }
}
Also used : CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) TaskStatus(org.openstack4j.model.image.v2.Task.TaskStatus)

Aggregations

CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1 TaskStatus (org.openstack4j.model.image.v2.Task.TaskStatus)1