Search in sources :

Example 36 with ImageEntity

use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.

the class ImageService method revertImageToRevision.

public void revertImageToRevision(Long imageEntityId, Number revision) {
    ImageEntity originalImageEntity = auditReader.find(ImageEntity.class, imageEntityId, revision);
    LOGGER.info("Reverting to revision [{}] using {}", revision, originalImageEntity);
    ImageEntity imageEntity = imageRepository.findById(imageEntityId).get();
    imageEntity.setImageName(originalImageEntity.getImageName());
    imageEntity.setImageId(originalImageEntity.getImageId());
    imageEntity.setImageCatalogName(originalImageEntity.getImageCatalogName());
    imageEntity.setImageCatalogUrl(originalImageEntity.getImageCatalogUrl());
    imageRepository.save(imageEntity);
    LOGGER.info("Image reverted");
}
Also used : ImageEntity(com.sequenceiq.freeipa.entity.ImageEntity)

Example 37 with ImageEntity

use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.

the class ImageService method getImageForStack.

private Image getImageForStack(Stack stack) {
    final ImageEntity imageEntity = getByStack(stack);
    final ImageSettingsRequest imageSettings = imageEntityToImageSettingsRequest(imageEntity);
    final ImageWrapper imageWrapper = getImage(imageSettings, stack.getRegion(), getPlatformString(stack));
    return imageWrapper.getImage();
}
Also used : ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest) ImageEntity(com.sequenceiq.freeipa.entity.ImageEntity) ImageWrapper(com.sequenceiq.freeipa.dto.ImageWrapper)

Example 38 with ImageEntity

use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.

the class ImageService method create.

public ImageEntity create(Stack stack, ImageSettingsRequest imageRequest) {
    Pair<ImageWrapper, String> imageWrapperAndNamePair = fetchImageWrapperAndName(stack, imageRequest);
    ImageEntity imageEntity = createImageEntity(stack, imageWrapperAndNamePair);
    return imageRepository.save(imageEntity);
}
Also used : ImageWrapper(com.sequenceiq.freeipa.dto.ImageWrapper) ImageEntity(com.sequenceiq.freeipa.entity.ImageEntity)

Example 39 with ImageEntity

use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.

the class ImageService method updateImageWithNewValues.

private ImageEntity updateImageWithNewValues(Stack stack, ImageWrapper imageWrapper, String imageName) {
    ImageEntity imageEntity = imageRepository.getByStack(stack);
    imageEntity.setImageName(imageName);
    imageEntity.setImageId(imageWrapper.getImage().getUuid());
    imageEntity.setImageCatalogUrl(imageWrapper.getCatalogUrl());
    imageEntity.setImageCatalogName(imageWrapper.getCatalogName());
    imageEntity.setDate(imageWrapper.getImage().getDate());
    return imageEntity;
}
Also used : ImageEntity(com.sequenceiq.freeipa.entity.ImageEntity)

Aggregations

ImageEntity (com.sequenceiq.freeipa.entity.ImageEntity)39 Stack (com.sequenceiq.freeipa.entity.Stack)17 Test (org.junit.jupiter.api.Test)14 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)10 ImageSettingsRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest)7 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)5 ImageWrapper (com.sequenceiq.freeipa.dto.ImageWrapper)5 ImageChangeEvent (com.sequenceiq.freeipa.flow.stack.image.change.event.ImageChangeEvent)4 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)3 BootstrapParams (com.sequenceiq.cloudbreak.orchestrator.model.BootstrapParams)3 FlowParameters (com.sequenceiq.flow.core.FlowParameters)3 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)3 UserSyncStatus (com.sequenceiq.freeipa.entity.UserSyncStatus)3 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)3 StackBasedExitCriteriaModel (com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel)3 HashMap (java.util.HashMap)3 Set (java.util.Set)3 Authenticator (com.sequenceiq.cloudbreak.cloud.Authenticator)2 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)2 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2