Search in sources :

Example 6 with Component

use of com.sequenceiq.cloudbreak.domain.stack.Component in project cloudbreak by hortonworks.

the class ComponentConfigProviderService method replaceImageComponentWithNew.

public void replaceImageComponentWithNew(Component component) {
    Component componentEntity = componentRepository.findComponentByStackIdComponentTypeName(component.getStack().getId(), component.getComponentType(), component.getName()).orElseThrow(NotFoundException.notFound("component", component.getName()));
    componentEntity.setAttributes(component.getAttributes());
    componentEntity.setName(component.getName());
    componentRepository.save(componentEntity);
}
Also used : Component(com.sequenceiq.cloudbreak.domain.stack.Component)

Example 7 with Component

use of com.sequenceiq.cloudbreak.domain.stack.Component in project cloudbreak by hortonworks.

the class ImageService method addImage.

private void addImage(Stack stack, Map<InstanceGroupType, String> userData, StatedImage statedImage, String imageName, com.sequenceiq.cloudbreak.cloud.model.catalog.Image catalogBasedImage, Set<Component> components) {
    Image image = new Image(imageName, userData, catalogBasedImage.getOs(), catalogBasedImage.getOsType(), statedImage.getImageCatalogUrl(), statedImage.getImageCatalogName(), catalogBasedImage.getUuid(), catalogBasedImage.getPackageVersions());
    components.add(new Component(IMAGE, IMAGE.name(), new Json(image), stack));
}
Also used : Json(com.sequenceiq.cloudbreak.common.json.Json) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Component(com.sequenceiq.cloudbreak.domain.stack.Component)

Example 8 with Component

use of com.sequenceiq.cloudbreak.domain.stack.Component 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 9 with Component

use of com.sequenceiq.cloudbreak.domain.stack.Component in project cloudbreak by hortonworks.

the class ImageService method decorateImageWithUserDataForStack.

public void decorateImageWithUserDataForStack(Stack stack, Map<InstanceGroupType, String> userData) throws CloudbreakImageNotFoundException {
    Image image = componentConfigProviderService.getImage(stack.getId());
    image.setUserdata(userData);
    Component imageComponent = new Component(IMAGE, IMAGE.name(), new Json(image), stack);
    componentConfigProviderService.replaceImageComponentWithNew(imageComponent);
}
Also used : Json(com.sequenceiq.cloudbreak.common.json.Json) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Component(com.sequenceiq.cloudbreak.domain.stack.Component)

Example 10 with Component

use of com.sequenceiq.cloudbreak.domain.stack.Component in project cloudbreak by hortonworks.

the class ClusterUpgradeTargetImageService method createTargetImageComponent.

private Component createTargetImageComponent(Long stackId, StatedImage targetImage) {
    Stack stack = stackService.getById(stackId);
    Image imageModel = stackImageService.getImageModelFromStatedImage(stack, getCurrentImage(stack), targetImage);
    return new Component(ComponentType.IMAGE, TARGET_IMAGE, new Json(imageModel), stack);
}
Also used : Json(com.sequenceiq.cloudbreak.common.json.Json) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Component(com.sequenceiq.cloudbreak.domain.stack.Component) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

Component (com.sequenceiq.cloudbreak.domain.stack.Component)37 Json (com.sequenceiq.cloudbreak.common.json.Json)16 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)14 Image (com.sequenceiq.cloudbreak.cloud.model.Image)12 Test (org.junit.jupiter.api.Test)11 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)6 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)6 ClusterComponent (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent)6 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)5 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)5 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)5 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)4 StackMatrixV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)4 ImageBasedDefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)4 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)4 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)4 CmSyncOperationResult (com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmSyncOperationResult)4 DefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.DefaultCDHInfo)3 ComponentType (com.sequenceiq.cloudbreak.common.type.ComponentType)3 CmParcelSyncOperationResult (com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmParcelSyncOperationResult)3