use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getSecurityGroups.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudSecurityGroups getSecurityGroups(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform securitygroups");
GetPlatformSecurityGroupsRequest getPlatformSecurityGroupsRequest = new GetPlatformSecurityGroupsRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformSecurityGroupsRequest.selector(), eventFactory.createEvent(getPlatformSecurityGroupsRequest));
try {
GetPlatformSecurityGroupsResult res = getPlatformSecurityGroupsRequest.await();
LOGGER.debug("Platform securitygroups types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform securitygroups", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get security groups for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
if (res.getStatus().equals(EventStatus.PERMANENTLY_FAILED)) {
LOGGER.debug("Failed to get platform accessConfigs", res.getErrorDetails());
throw new BadRequestException(res.getStatusReason());
}
return res.getCloudSecurityGroups();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform securitygroups", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getInstanceGroupParameters.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public Map<String, InstanceGroupParameterResponse> getInstanceGroupParameters(ExtendedCloudCredential cloudCredential, Set<InstanceGroupParameterRequest> instanceGroups) {
LOGGER.debug("Get platform instanceGroupParameters");
GetPlatformInstanceGroupParameterRequest getPlatformInstanceGroupParameterRequest = new GetPlatformInstanceGroupParameterRequest(cloudCredential, cloudCredential, instanceGroups, null);
eventBus.notify(getPlatformInstanceGroupParameterRequest.selector(), Event.wrap(getPlatformInstanceGroupParameterRequest));
try {
GetPlatformInstanceGroupParameterResult res = getPlatformInstanceGroupParameterRequest.await();
LOGGER.debug("Platform instanceGroupParameterResult result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform instanceGroupParameterResult", res.getErrorDetails());
throw new GetCloudParameterException(String.format("Failed to get instance group parameters for the cloud provider: %s. %s", res.getStatusReason(), getCauseMessages(res.getErrorDetails())), res.getErrorDetails());
}
return res.getInstanceGroupParameterResponses();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform instanceGroupParameterResult", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getOrchestrators.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public PlatformOrchestrators getOrchestrators() {
LOGGER.debug("Get platform orchestrators");
GetPlatformOrchestratorsRequest getPlatformOrchestratorsRequest = new GetPlatformOrchestratorsRequest();
eventBus.notify(getPlatformOrchestratorsRequest.selector(), eventFactory.createEvent(getPlatformOrchestratorsRequest));
try {
GetPlatformOrchestratorsResult res = getPlatformOrchestratorsRequest.await();
LOGGER.debug("Platform orchestrators result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform orchestrators", res.getErrorDetails());
throw new GetCloudParameterException(getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getPlatformOrchestrators();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform orchestrators", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class StackProvisionService method checkImage.
public CheckImageResult checkImage(StackContext context) {
try {
Stack stack = context.getStack();
com.sequenceiq.cloudbreak.cloud.model.Image image = imageConverter.convert(imageService.getByStack(stack));
CheckImageRequest<CheckImageResult> checkImageRequest = new CheckImageRequest<>(context.getCloudContext(), context.getCloudCredential(), cloudStackConverter.convert(stack), image);
LOGGER.debug("Triggering event: {}", checkImageRequest);
eventBus.notify(checkImageRequest.selector(), eventFactory.createEvent(checkImageRequest));
CheckImageResult result = checkImageRequest.await();
LOGGER.debug("Result: {}", result);
return result;
} catch (InterruptedException e) {
LOGGER.error("Error while executing check image", e);
throw new OperationException(e);
} catch (Exception e) {
throw new CloudbreakServiceException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class PlatformParameterService method getPlatformParameters.
public PlatformParameters getPlatformParameters(Stack stack, Credential credential) {
MDCBuilder.getOrGenerateRequestId();
LOGGER.debug("Get platform parameters for: {}", stack);
CloudContext cloudContext = CloudContext.Builder.builder().withPlatform(stack.getCloudPlatform()).withVariant(stack.getPlatformvariant()).build();
CloudCredential cloudCredential = credentialConverter.convert(credential);
PlatformParameterRequest parameterRequest = new PlatformParameterRequest(cloudContext, cloudCredential);
freeIpaFlowManager.notifyNonFlowEvent(parameterRequest);
try {
PlatformParameterResult res = parameterRequest.await();
LOGGER.debug("Platform parameter result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform parameters", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getPlatformParameters();
} catch (InterruptedException e) {
LOGGER.error("Error while getting platform parameters: " + cloudContext, e);
throw new OperationException(e);
}
}
Aggregations