Search in sources :

Example 1 with ImageStackDetails

use of com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails in project cloudbreak by hortonworks.

the class ImageService method addCmRepo.

private void addCmRepo(Stack stack, Set<Component> components, com.sequenceiq.cloudbreak.cloud.model.catalog.Image catalogBasedImage) throws CloudbreakImageCatalogException {
    if (catalogBasedImage.getStackDetails() != null) {
        ImageStackDetails stackDetails = catalogBasedImage.getStackDetails();
        StackType stackType = determineStackType(stackDetails);
        ClouderaManagerRepo clouderaManagerRepo = getClouderaManagerRepo(catalogBasedImage, stackType);
        components.add(new Component(CM_REPO_DETAILS, CM_REPO_DETAILS.name(), new Json(clouderaManagerRepo), stack));
    } else {
        LOGGER.debug("There are no stackDetails for stack {}, cannot determine CM repo version.", stack.getName());
    }
}
Also used : StackType(com.sequenceiq.cloudbreak.cloud.model.component.StackType) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Json(com.sequenceiq.cloudbreak.common.json.Json) Component(com.sequenceiq.cloudbreak.domain.stack.Component)

Example 2 with ImageStackDetails

use of com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails in project cloudbreak by hortonworks.

the class CustomImageProvider method getStackDetailsWithCustomBaseUrl.

private ImageStackDetails getStackDetailsWithCustomBaseUrl(ImageStackDetails details, String customBaseUrl) {
    if (details != null) {
        Map<String, String> stack = details.getRepo().getStack().entrySet().stream().collect(toMap(Map.Entry::getKey, e -> changeBaseUrlToCustomUrl(e.getValue(), customBaseUrl)));
        StackRepoDetails repoDetails = new StackRepoDetails(stack, details.getRepo().getUtil());
        return new ImageStackDetails(details.getVersion(), repoDetails, details.getStackBuildNumber());
    }
    return null;
}
Also used : ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) Set(java.util.Set) VmImage(com.sequenceiq.cloudbreak.domain.VmImage) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) Component(org.springframework.stereotype.Component) List(java.util.List) Collectors.toMap(java.util.stream.Collectors.toMap) CustomImage(com.sequenceiq.cloudbreak.domain.CustomImage) Map(java.util.Map) Optional(java.util.Optional) Collections(java.util.Collections) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map)

Example 3 with ImageStackDetails

use of com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails in project cloudbreak by hortonworks.

the class ImageBasedDefaultCDHEntriesTest method getImages.

private List<Image> getImages() {
    StackRepoDetails stackRepoDetails = new StackRepoDetails(getRepo(), null);
    ImageStackDetails stackDetails = new ImageStackDetails(null, stackRepoDetails, null);
    List<List<String>> parcels = getParcels();
    Image defaultImage = mock(Image.class);
    when(defaultImage.isDefaultImage()).thenReturn(true);
    when(defaultImage.getVersion()).thenReturn(IMAGE_VERSION);
    when(defaultImage.getStackDetails()).thenReturn(stackDetails);
    when(defaultImage.getPreWarmParcels()).thenReturn(parcels);
    when(defaultImage.getPreWarmCsd()).thenReturn(PRE_WARM_CSD);
    Image nonDefaultImage = mock(Image.class);
    when(nonDefaultImage.isDefaultImage()).thenReturn(false);
    // the algorithm is not failing on multiple default images for the same version
    return asList(defaultImage, defaultImage, nonDefaultImage);
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Arrays.asList(java.util.Arrays.asList) List(java.util.List) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image)

Example 4 with ImageStackDetails

use of com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails in project cloudbreak by hortonworks.

the class ImageCreationBasedUpgradeImageFilterTest method mockSameVersion.

private void mockSameVersion(Image current, Image candidate) {
    ImageStackDetails currentStackDetails = mock(ImageStackDetails.class);
    ImageStackDetails candidateStackDetails = mock(ImageStackDetails.class);
    when(current.getStackDetails()).thenReturn(currentStackDetails);
    when(candidate.getStackDetails()).thenReturn(candidateStackDetails);
    when(currentStackDetails.getVersion()).thenReturn("a");
    when(candidateStackDetails.getVersion()).thenReturn("a");
}
Also used : ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails)

Example 5 with ImageStackDetails

use of com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails in project cloudbreak by hortonworks.

the class StackVersionMatcherTest method testMissingStackRepoDetails.

@Test
public void testMissingStackRepoDetails() {
    when(image.getStackDetails()).thenReturn(new ImageStackDetails("ver", null, "build"));
    boolean result = underTest.isMatchingStackVersion(image, ACTIVATED_PARCELS);
    assertTrue(result);
}
Also used : ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Test(org.junit.jupiter.api.Test)

Aggregations

ImageStackDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails)25 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails)16 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)13 Test (org.junit.jupiter.api.Test)13 Map (java.util.Map)4 List (java.util.List)3 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)2 Component (com.sequenceiq.cloudbreak.domain.stack.Component)2 HashMap (java.util.HashMap)2 BaseStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response)1 ImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response)1 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 CustomImage (com.sequenceiq.cloudbreak.domain.CustomImage)1 VmImage (com.sequenceiq.cloudbreak.domain.VmImage)1 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)1 Arrays.asList (java.util.Arrays.asList)1 Collections (java.util.Collections)1 Optional (java.util.Optional)1 Set (java.util.Set)1