Search in sources :

Example 1 with StackTemplate

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);
    }
}
Also used : StackTemplate(com.sequenceiq.cloudbreak.cloud.model.StackTemplate) InstanceGroupAdjustmentJson(com.sequenceiq.cloudbreak.api.model.InstanceGroupAdjustmentJson) Json(com.sequenceiq.cloudbreak.domain.json.Json) Component(com.sequenceiq.cloudbreak.domain.Component) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 2 with StackTemplate

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());
}
Also used : AmbariDatabase(com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) HashMap(java.util.HashMap) CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) StackTemplate(com.sequenceiq.cloudbreak.cloud.model.StackTemplate) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Before(org.junit.Before)

Example 3 with StackTemplate

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());
}
Also used : InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup) Group(com.sequenceiq.cloudbreak.cloud.model.Group) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) Network(com.sequenceiq.cloudbreak.cloud.model.Network) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) StackTemplate(com.sequenceiq.cloudbreak.cloud.model.StackTemplate) Image(com.sequenceiq.cloudbreak.cloud.model.Image) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack)

Aggregations

StackTemplate (com.sequenceiq.cloudbreak.cloud.model.StackTemplate)3 Image (com.sequenceiq.cloudbreak.cloud.model.Image)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 InstanceGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.InstanceGroupAdjustmentJson)1 AmbariDatabase (com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase)1 AmbariRepo (com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)1 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 CloudbreakDetails (com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails)1 Group (com.sequenceiq.cloudbreak.cloud.model.Group)1 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)1 Network (com.sequenceiq.cloudbreak.cloud.model.Network)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 Component (com.sequenceiq.cloudbreak.domain.Component)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1