use of com.sequenceiq.cloudbreak.cloud.model.StackTemplate in project cloudbreak by hortonworks.
the class StackService method addTemplateForStack.
private void addTemplateForStack(Stack stack, String template) {
StackTemplate stackTemplate = new StackTemplate(template, cbVersion);
try {
Component stackTemplateComponent = new Component(ComponentType.STACK_TEMPLATE, ComponentType.STACK_TEMPLATE.name(), new Json(stackTemplate), stack);
componentConfigProvider.store(stackTemplateComponent);
} catch (JsonProcessingException e) {
LOGGER.error("Could not create Cloudbreak details component.", e);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.StackTemplate in project cloudbreak by hortonworks.
the class StackToStackResponseConverterTest method setUp.
@Before
public void setUp() throws CloudbreakImageNotFoundException {
underTest = new StackToStackResponseConverter();
MockitoAnnotations.initMocks(this);
when(imageService.getImage(anyLong())).thenReturn(new Image("cb-centos66-amb200-2015-05-25", new HashMap<>(), "redhat6", "", "default", "default-id"));
when(componentConfigProvider.getCloudbreakDetails(anyLong())).thenReturn(new CloudbreakDetails("version"));
when(componentConfigProvider.getStackTemplate(anyLong())).thenReturn(new StackTemplate("{}", "version"));
when(clusterComponentConfigProvider.getHDPRepo(anyLong())).thenReturn(new StackRepoDetails());
when(clusterComponentConfigProvider.getAmbariDatabase(anyLong())).thenReturn(new AmbariDatabase());
when(clusterComponentConfigProvider.getAmbariRepo(anyLong())).thenReturn(new AmbariRepo());
}
use of com.sequenceiq.cloudbreak.cloud.model.StackTemplate in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method convert.
public CloudStack convert(Stack stack, Collection<String> deleteRequestedInstances) {
Image image = null;
List<Group> instanceGroups = buildInstanceGroups(stack.getInstanceGroupsAsList(), stack.getStackAuthentication(), deleteRequestedInstances);
try {
image = imageService.getImage(stack.getId());
} catch (CloudbreakImageNotFoundException e) {
LOGGER.info(e.getMessage());
}
Network network = buildNetwork(stack);
StackTemplate stackTemplate = componentConfigProvider.getStackTemplate(stack.getId());
InstanceAuthentication instanceAuthentication = buildInstanceAuthentication(stack.getStackAuthentication());
String template = null;
if (stackTemplate != null) {
template = stackTemplate.getTemplate();
}
return new CloudStack(instanceGroups, network, image, stack.getParameters(), getUserDefinedTags(stack), template, instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey());
}
Aggregations