use of com.sequenceiq.it.cloudbreak.util.WaitResult in project cloudbreak by hortonworks.
the class CleanupUtil method deleteSdx.
private void deleteSdx(SdxClient sdxClient, String sdxName) {
try {
sdxClient.sdxEndpoint().delete(sdxName, true);
WaitResult waitResult = waitUtil.waitForSdxCleanup(sdxClient, sdxName);
if (waitResult == WaitResult.FAILED) {
throw new RuntimeException(String.format("Failed: Deleting %s data lake (sdx) has been failed!", sdxName));
}
if (waitResult == WaitResult.TIMEOUT) {
throw new RuntimeException(String.format("Timeout: Deleting %s data lake (sdx) has been timed out!", sdxName));
}
} catch (NotFoundException e) {
LOG.info("{} data lake (sdx) have already been deleted", sdxName);
} catch (Exception e) {
LOG.error("{} data lake (sdx) cannot be deleted, because of: {}", sdxName, e.getMessage(), e);
throw new RuntimeException(String.format("%s data lake (sdx) cannot be deleted, because of: %s", sdxName, e.getMessage()));
}
}
use of com.sequenceiq.it.cloudbreak.util.WaitResult in project cloudbreak by hortonworks.
the class CleanupUtil method deleteEnvironments.
private void deleteEnvironments(EnvironmentClient environmentClient, List<String> environmentNames) {
try {
environmentNames.forEach(environmentName -> LOG.info("Environment with name: {} will be deleted!", environmentName));
environmentClient.environmentV1Endpoint().deleteMultipleByNames(new HashSet<>(environmentNames), true, false);
environmentNames.forEach(environmentName -> {
WaitResult waitResult = waitUtil.waitForEnvironmentCleanup(environmentClient, environmentName);
if (waitResult == WaitResult.FAILED) {
throw new RuntimeException(String.format("Failed: Deleting %s environment has been failed!", environmentName));
}
if (waitResult == WaitResult.TIMEOUT) {
throw new RuntimeException(String.format("Timeout: Deleting %s environment has been timed out!", environmentName));
}
});
} catch (Exception e) {
LOG.error("One or more environment cannot be deleted, because of: {}", e.getMessage(), e);
throw new RuntimeException(String.format("One or more environment cannot be deleted, because of: %s", e.getMessage()));
}
}
use of com.sequenceiq.it.cloudbreak.util.WaitResult in project cloudbreak by hortonworks.
the class CleanupUtil method deleteEnvironment.
private void deleteEnvironment(EnvironmentClient environmentClient, String environmentName) {
try {
environmentClient.environmentV1Endpoint().deleteByName(environmentName, true, false);
WaitResult waitResult = waitUtil.waitForEnvironmentCleanup(environmentClient, environmentName);
if (waitResult == WaitResult.FAILED) {
throw new RuntimeException(String.format("Failed: Deleting %s environment has been failed!", environmentName));
}
if (waitResult == WaitResult.TIMEOUT) {
throw new RuntimeException(String.format("Timeout: Deleting %s environment has been timed out!", environmentName));
}
} catch (NotFoundException e) {
LOG.info("{} environment have already been deleted", environmentName);
} catch (Exception e) {
LOG.error("{} environment cannot be deleted, because of: {}", environmentName, e.getMessage(), e);
throw new RuntimeException(String.format("%s environment cannot be deleted, because of: %s", environmentName, e.getMessage()));
}
}
use of com.sequenceiq.it.cloudbreak.util.WaitResult in project cloudbreak by hortonworks.
the class CleanupUtil method deleteDistrox.
private void deleteDistrox(CloudbreakClient cloudbreakClient, String distroxName) {
try {
cloudbreakClient.distroXV1Endpoint().deleteByName(distroxName, true);
WaitResult waitResult = waitUtil.waitForDistroxCleanup(cloudbreakClient, distroxName);
if (waitResult == WaitResult.FAILED) {
throw new RuntimeException(String.format("Failed: Deleting %s data hub (distrox) has been failed!", distroxName));
}
if (waitResult == WaitResult.TIMEOUT) {
throw new RuntimeException(String.format("Timeout: Deleting %s data hub (distrox) has been timed out!", distroxName));
}
} catch (NotFoundException e) {
LOG.info("{} data hub (distrox) have already been deleted", distroxName);
} catch (Exception e) {
LOG.error("{} data hub (distrox) cannot be deleted, because of: {}", distroxName, e.getMessage(), e);
throw new RuntimeException(String.format("%s data hub (distrox) cannot be deleted, because of: %s", distroxName, e.getMessage()));
}
}
Aggregations