use of com.sequenceiq.cloudbreak.cloud.template.ResourceNotNeededException in project cloudbreak by hortonworks.
the class GroupResourceService method buildResources.
public List<CloudResourceStatus> buildResources(ResourceBuilderContext context, AuthenticatedContext auth, Iterable<Group> groups, Network network, Security security) throws Exception {
CloudContext cloudContext = auth.getCloudContext();
List<CloudResourceStatus> results = new ArrayList<>();
for (GroupResourceBuilder builder : resourceBuilders.group(cloudContext.getPlatform())) {
PollGroup pollGroup = InMemoryStateStore.getStack(auth.getCloudContext().getId());
if (pollGroup != null && CANCELLED.equals(pollGroup)) {
break;
}
for (Group group : getOrderedCopy(groups)) {
try {
CloudResource buildableResource = builder.create(context, auth, group, network);
createResource(auth, buildableResource);
CloudResource resource = builder.build(context, auth, group, network, group.getSecurity(), buildableResource);
updateResource(auth, resource);
PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask(builder, auth, Collections.singletonList(resource), context, true);
List<CloudResourceStatus> pollerResult = syncPollingScheduler.schedule(task);
context.addGroupResources(group.getName(), Collections.singletonList(resource));
results.addAll(pollerResult);
} catch (ResourceNotNeededException e) {
LOGGER.warn("Skipping resource creation: {}", e.getMessage());
}
}
}
return results;
}
use of com.sequenceiq.cloudbreak.cloud.template.ResourceNotNeededException in project cloudbreak by hortonworks.
the class NetworkResourceService method buildResources.
public List<CloudResourceStatus> buildResources(ResourceBuilderContext context, AuthenticatedContext auth, Network network, Security security) throws Exception {
CloudContext cloudContext = auth.getCloudContext();
List<CloudResourceStatus> results = new ArrayList<>();
for (NetworkResourceBuilder builder : resourceBuilders.network(cloudContext.getPlatform())) {
PollGroup pollGroup = InMemoryStateStore.getStack(auth.getCloudContext().getId());
if (pollGroup != null && CANCELLED.equals(pollGroup)) {
break;
}
try {
CloudResource buildableResource = builder.create(context, auth, network);
createResource(auth, buildableResource);
CloudResource resource = builder.build(context, auth, network, security, buildableResource);
updateResource(auth, resource);
PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask(builder, auth, Collections.singletonList(resource), context, true);
List<CloudResourceStatus> pollerResult = syncPollingScheduler.schedule(task);
results.addAll(pollerResult);
} catch (ResourceNotNeededException e) {
LOGGER.warn("Skipping resource creation: {}", e.getMessage());
}
}
return results;
}
Aggregations