Search in sources :

Example 16 with StackRepoDetails

use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.

the class ClusterHostServiceRunner method saveHDPPillar.

private void saveHDPPillar(Long clusterId, Map<String, SaltPillarProperties> servicePillar) {
    StackRepoDetails hdprepo = clusterComponentConfigProvider.getHDPRepo(clusterId);
    servicePillar.put("hdp", new SaltPillarProperties("/hdp/repo.sls", singletonMap("hdp", hdprepo)));
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Example 17 with StackRepoDetails

use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.

the class ImageService method createHDFRepo.

private StackRepoDetails createHDFRepo(StackDetails hdfStack) {
    com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails hdfRepo = hdfStack.getRepo();
    StackRepoDetails repo = new StackRepoDetails();
    repo.setHdpVersion(hdfStack.getVersion());
    repo.setStack(hdfRepo.getStack());
    repo.setUtil(hdfRepo.getUtil());
    repo.setKnox(hdfRepo.getKnox());
    return repo;
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)

Example 18 with StackRepoDetails

use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.

the class ClusterToClusterResponseConverter method convertComponentConfig.

private void convertComponentConfig(ClusterResponse response, Cluster source) {
    try {
        AmbariRepo ambariRepo = componentConfigProvider.getAmbariRepo(source.getComponents());
        if (ambariRepo != null) {
            AmbariRepoDetailsJson ambariRepoDetailsJson = getConversionService().convert(ambariRepo, AmbariRepoDetailsJson.class);
            response.setAmbariRepoDetailsJson(ambariRepoDetailsJson);
        }
        StackRepoDetails stackRepoDetails = componentConfigProvider.getStackRepo(source.getComponents());
        if (stackRepoDetails != null) {
            AmbariStackDetailsResponse ambariRepoDetailsJson = getConversionService().convert(stackRepoDetails, AmbariStackDetailsResponse.class);
            response.setAmbariStackDetails(ambariRepoDetailsJson);
        }
    } catch (RuntimeException e) {
        LOGGER.error("Failed to convert dynamic component.", e);
    }
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) AmbariStackDetailsResponse(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsResponse) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)

Example 19 with StackRepoDetails

use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.

the class AmbariClusterService method createHDPRepoComponent.

private void createHDPRepoComponent(StackRepoDetails stackRepoDetailsUpdate, Stack stack) {
    if (stackRepoDetailsUpdate != null) {
        StackRepoDetails stackRepoDetails = clusterComponentConfigProvider.getHDPRepo(stack.getCluster().getId());
        if (stackRepoDetails == null) {
            try {
                ClusterComponent clusterComp = new ClusterComponent(ComponentType.HDP_REPO_DETAILS, new Json(stackRepoDetailsUpdate), stack.getCluster());
                clusterComponentConfigProvider.store(clusterComp);
            } catch (JsonProcessingException ignored) {
                throw new BadRequestException(String.format("HDP Repo parameters cannot be converted. %s", stackRepoDetailsUpdate));
            }
        } else {
            ClusterComponent component = clusterComponentConfigProvider.getComponent(stack.getCluster().getId(), ComponentType.HDP_REPO_DETAILS);
            stackRepoDetails.setHdpVersion(stackRepoDetailsUpdate.getHdpVersion());
            stackRepoDetails.setVerify(stackRepoDetailsUpdate.isVerify());
            stackRepoDetails.setStack(stackRepoDetailsUpdate.getStack());
            stackRepoDetails.setUtil(stackRepoDetailsUpdate.getUtil());
            stackRepoDetails.setEnableGplRepo(stackRepoDetailsUpdate.isEnableGplRepo());
            stackRepoDetails.setKnox(stackRepoDetailsUpdate.getKnox());
            try {
                component.setAttributes(new Json(stackRepoDetails));
                clusterComponentConfigProvider.store(component);
            } catch (JsonProcessingException ignored) {
                throw new BadRequestException(String.format("HDP Repo parameters cannot be converted. %s", stackRepoDetailsUpdate));
            }
        }
    }
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) BadRequestException(com.sequenceiq.cloudbreak.controller.BadRequestException) BlueprintParameterJson(com.sequenceiq.cloudbreak.api.model.BlueprintParameterJson) UserNamePasswordJson(com.sequenceiq.cloudbreak.api.model.UserNamePasswordJson) HostGroupAdjustmentJson(com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson) Json(com.sequenceiq.cloudbreak.domain.json.Json) BlueprintInputJson(com.sequenceiq.cloudbreak.api.model.BlueprintInputJson) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 20 with StackRepoDetails

use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.

the class AmbariRepositoryVersionService method getRepositoryVersion.

public String getRepositoryVersion(long clusterId, Orchestrator orchestrator) throws CloudbreakException {
    StackRepoDetails stackRepoDetails = getStackRepoDetails(clusterId, orchestrator);
    AmbariRepo ambariRepoDetails = clusterComponentConfigProvider.getAmbariRepo(clusterId);
    String result = "";
    if (stackRepoDetails != null && isVersionNewerOrEqualThanLimited(ambariRepoDetails::getVersion, AMBARI_VERSION_2_6_0_0)) {
        Optional<String> repositoryVersion = Optional.ofNullable(stackRepoDetails.getStack().get(StackRepoDetails.REPOSITORY_VERSION));
        result = repositoryVersion.orElse("");
    }
    return result;
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)

Aggregations

StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)21 AmbariRepo (com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)7 Test (org.junit.Test)4 AmbariStackDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson)3 CloudbreakDetails (com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails)3 Image (com.sequenceiq.cloudbreak.cloud.model.Image)3 ClusterComponent (com.sequenceiq.cloudbreak.domain.ClusterComponent)3 Json (com.sequenceiq.cloudbreak.domain.json.Json)3 AmbariRepoDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 AmbariStackDetailsResponse (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsResponse)1 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)1 BlueprintParameterJson (com.sequenceiq.cloudbreak.api.model.BlueprintParameterJson)1 CloudbreakDetailsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson)1