use of com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson in project cloudbreak by hortonworks.
the class ClusterCreationSetupService method determineHDPRepoConfig.
private ClusterComponent determineHDPRepoConfig(Blueprint blueprint, long stackId, Optional<Component> stackHdpRepoConfig, ClusterRequest request, Cluster cluster, IdentityUser user, Optional<Component> stackImageComponent) throws JsonProcessingException {
Json stackRepoDetailsJson;
if (!stackHdpRepoConfig.isPresent()) {
AmbariStackDetailsJson ambariStackDetails = request.getAmbariStackDetails();
if (ambariStackDetails != null) {
setOsTypeFromImageIfMissing(cluster, stackImageComponent, ambariStackDetails);
StackRepoDetails stackRepoDetails = conversionService.convert(ambariStackDetails, StackRepoDetails.class);
stackRepoDetailsJson = new Json(stackRepoDetails);
} else {
StackRepoDetails stackRepoDetails = SerializationUtils.clone(defaultHDPInfo(blueprint, request, user).getRepo());
Optional<String> vdfUrl = getVDFUrlByOsType(stackId, stackRepoDetails);
vdfUrl.ifPresent(s -> stackRepoDetails.getStack().put(CUSTOM_VDF_REPO_KEY, s));
stackRepoDetailsJson = new Json(stackRepoDetails);
}
} else {
stackRepoDetailsJson = stackHdpRepoConfig.get().getAttributes();
}
return new ClusterComponent(ComponentType.HDP_REPO_DETAILS, stackRepoDetailsJson, cluster);
}
use of com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson in project cloudbreak by hortonworks.
the class AmbariStackDetailsJsonToStackRepoDetailsConverterTest method testConvertWhenVDFProvided.
@Test
public void testConvertWhenVDFProvided() {
AmbariStackDetailsJson request = getRequest("stack/ambari-stack-details-vdf.json");
StackRepoDetails result = underTest.convert(request);
Assert.assertFalse(result.getStack().containsKey(request.getOs()));
}
use of com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson in project cloudbreak by hortonworks.
the class ClusterCommonService method recreateCluster.
private void recreateCluster(Long stackId, UpdateClusterJson updateJson) {
IdentityUser user = authenticatedUserService.getCbUser();
Set<HostGroup> hostGroups = new HashSet<>();
for (HostGroupRequest json : updateJson.getHostgroups()) {
HostGroup hostGroup = conversionService.convert(json, HostGroup.class);
hostGroup = hostGroupDecorator.decorate(hostGroup, json, user, stackId, false, false);
hostGroups.add(hostGroup);
}
AmbariStackDetailsJson stackDetails = updateJson.getAmbariStackDetails();
StackRepoDetails stackRepoDetails = null;
if (stackDetails != null) {
stackRepoDetails = conversionService.convert(stackDetails, StackRepoDetails.class);
}
clusterService.recreate(stackId, updateJson.getBlueprintId(), hostGroups, updateJson.getValidateBlueprint(), stackRepoDetails, updateJson.getKerberosPassword(), updateJson.getKerberosPrincipal());
}
use of com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson in project cloudbreak by hortonworks.
the class StackRepoDetailsToStackRepoDetailsJsonConverter method convert.
@Override
public AmbariStackDetailsJson convert(StackRepoDetails source) {
AmbariStackDetailsJson ambariStackDetailsJson = new AmbariStackDetailsJson();
Map<String, String> stack = source.getStack();
ambariStackDetailsJson.setStackRepoId(stack.get(StackRepoDetails.REPO_ID_TAG));
ambariStackDetailsJson.setStack(stack.get(StackRepoDetails.REPO_ID_TAG));
ambariStackDetailsJson.setRepositoryVersion(stack.get(StackRepoDetails.REPOSITORY_VERSION));
ambariStackDetailsJson.setVersionDefinitionFileUrl(stack.get(StackRepoDetails.CUSTOM_VDF_REPO_KEY));
ambariStackDetailsJson.setMpackUrl(stack.get(StackRepoDetails.MPACK_TAG));
if (stack.containsKey(REDHAT_6)) {
ambariStackDetailsJson.setOs(REDHAT_6);
ambariStackDetailsJson.setStackBaseURL(stack.get(REDHAT_6));
} else if (stack.containsKey(REDHAT_7)) {
ambariStackDetailsJson.setOs(REDHAT_7);
ambariStackDetailsJson.setStackBaseURL(stack.get(REDHAT_7));
} else if (stack.containsKey(DEBIAN_9)) {
ambariStackDetailsJson.setOs(DEBIAN_9);
ambariStackDetailsJson.setStackBaseURL(stack.get(DEBIAN_9));
} else if (stack.containsKey(UBUNTU_16)) {
ambariStackDetailsJson.setOs(UBUNTU_16);
ambariStackDetailsJson.setStackBaseURL(stack.get(UBUNTU_16));
}
Map<String, String> util = source.getUtil();
ambariStackDetailsJson.setUtilsRepoId(util.get(StackRepoDetails.REPO_ID_TAG));
if (util.containsKey(REDHAT_6)) {
ambariStackDetailsJson.setUtilsBaseURL(util.get(REDHAT_6));
} else if (util.containsKey(REDHAT_7)) {
ambariStackDetailsJson.setUtilsBaseURL(util.get(REDHAT_7));
} else if (util.containsKey(DEBIAN_9)) {
ambariStackDetailsJson.setUtilsBaseURL(util.get(DEBIAN_9));
} else if (util.containsKey(UBUNTU_16)) {
ambariStackDetailsJson.setUtilsBaseURL(util.get(UBUNTU_16));
}
ambariStackDetailsJson.setEnableGplRepo(source.isEnableGplRepo());
ambariStackDetailsJson.setVerify(source.isVerify());
ambariStackDetailsJson.setVersion(source.getHdpVersion());
return ambariStackDetailsJson;
}
Aggregations