use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response in project cloudbreak by hortonworks.
the class StackMatrixService method getSupportedOperatingSystems.
public Set<String> getSupportedOperatingSystems(Long workspaceId, String clusterVersion, String platform, String imageCatalogName) throws Exception {
StackMatrixV4Response stackMatrix = getStackMatrix(workspaceId, platform, imageCatalogName);
LOGGER.debug("Get Cloudera Manager stack info for determinigetSupportedOperationSystemsng the supported OS types for version: {}", clusterVersion);
ClouderaManagerStackDescriptorV4Response cmStackDescriptor = stackMatrix.getCdh().get(clusterVersion);
return cmStackDescriptor != null ? cmStackDescriptor.getClouderaManager().getRepository().keySet() : Collections.emptySet();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response in project cloudbreak by hortonworks.
the class DefaultClouderaManagerRepoService method getDefault.
public ClouderaManagerRepo getDefault(String osType, String clusterType, String clusterVersion, ImageCatalogPlatform platform) throws CloudbreakImageCatalogException {
if (StackType.CDH.name().equals(clusterType)) {
StackMatrixV4Response stackMatrixV4Response = stackMatrixService.getStackMatrix(platform);
Map<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorMap = stackMatrixV4Response.getCdh();
if (stackDescriptorMap != null) {
Optional<Entry<String, ClouderaManagerStackDescriptorV4Response>> descriptorEntry = stackDescriptorMap.entrySet().stream().filter(stackDescriptorEntry -> clusterVersion == null || clusterVersion.equals(stackDescriptorEntry.getKey())).max(Comparator.comparing(Entry::getKey));
if (descriptorEntry.isPresent()) {
Entry<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorEntry = descriptorEntry.get();
ClouderaManagerInfoV4Response clouderaManagerInfoJson = stackDescriptorEntry.getValue().getClouderaManager();
if (clouderaManagerInfoJson.getRepository().get(osType) != null) {
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setPredefined(false);
clouderaManagerRepo.setVersion(clouderaManagerInfoJson.getVersion());
clouderaManagerRepo.setBaseUrl(clouderaManagerInfoJson.getRepository().get(osType).getBaseUrl());
clouderaManagerRepo.setGpgKeyUrl(clouderaManagerInfoJson.getRepository().get(osType).getGpgKeyUrl());
return clouderaManagerRepo;
}
}
}
}
LOGGER.info("Missing Cloudera Manager Repo information for os: {} clusterType: {} clusterVersion: {}", osType, clusterType, clusterVersion);
return null;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response in project cloudbreak by hortonworks.
the class StackMatrixService method getSupportedOperatingSystems.
public Set<String> getSupportedOperatingSystems(Long workspaceId, String clusterVersion, ImageCatalogPlatform platform, String imageCatalogName) throws Exception {
StackMatrixV4Response stackMatrix = getStackMatrix(workspaceId, platform, imageCatalogName);
LOGGER.debug("Get Cloudera Manager stack info for determinigetSupportedOperationSystemsng the supported OS types for version: {}", clusterVersion);
ClouderaManagerStackDescriptorV4Response cmStackDescriptor = stackMatrix.getCdh().get(clusterVersion);
return cmStackDescriptor != null ? cmStackDescriptor.getClouderaManager().getRepository().keySet() : Collections.emptySet();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response in project cloudbreak by hortonworks.
the class ClusterCreationSetupServiceTest method init.
@Before
public void init() throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException, IOException {
MockitoAnnotations.initMocks(this);
workspace = new Workspace();
clusterRequest = new ClusterV4Request();
stack = new Stack();
stack.setId(1L);
stack.setWorkspace(workspace);
stack.setEnvironmentCrn("env");
stack.setName("name");
blueprint = new Blueprint();
blueprint.setBlueprintText("{}");
user = new User();
Map<InstanceGroupType, String> userData = new HashMap<>();
userData.put(InstanceGroupType.CORE, "userdata");
Image image = new Image("imagename", userData, "centos7", REDHAT_7, "url", "imgcatname", "id", Collections.emptyMap());
Component imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(image), stack);
cluster = new Cluster();
stack.setCluster(cluster);
when(clusterDecorator.decorate(any(), any(), any(), any(), any(), any())).thenReturn(cluster);
when(componentConfigProviderService.getAllComponentsByStackIdAndType(any(), any())).thenReturn(Sets.newHashSet(imageComponent));
when(blueprintUtils.getBlueprintStackVersion(any())).thenReturn(HDP_VERSION);
when(blueprintUtils.getBlueprintStackName(any())).thenReturn("HDP");
DefaultCDHInfo defaultCDHInfo = getDefaultCDHInfo(CDH_VERSION);
when(imageBasedDefaultCDHEntries.getEntries(workspace.getId(), imageCatalogPlatform(PLATFORM), IMAGE_CATALOG_NAME)).thenReturn(Collections.singletonMap(CDH_VERSION, new ImageBasedDefaultCDHInfo(defaultCDHInfo, Mockito.mock(com.sequenceiq.cloudbreak.cloud.model.catalog.Image.class))));
when(componentConfigProviderService.getImage(anyLong())).thenReturn(image);
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
stackMatrixV4Response.setCdh(Collections.singletonMap(CDH_VERSION, null));
when(stackMatrixService.getStackMatrix(workspace.getId(), imageCatalogPlatform(PLATFORM), IMAGE_CATALOG_NAME)).thenReturn(stackMatrixV4Response);
when(clouderaManagerClusterCreationSetupService.prepareClouderaManagerCluster(any(), any(), any(), any(), any())).thenReturn(new ArrayList<>());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response in project cloudbreak by hortonworks.
the class DefaultClouderaManagerRepoServiceTest method init.
@Before
public void init() throws Exception {
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
Map<String, ClouderaManagerStackDescriptorV4Response> cdhMap = new HashMap<>();
ClouderaManagerInfoV4Response clouderaManagerInfoJson610 = new ClouderaManagerInfoV4Response();
clouderaManagerInfoJson610.setVersion("6.1.0");
clouderaManagerInfoJson610.setRepository(RepoTestUtil.getClouderaManagerRepositoryResponse("6.1.0"));
ClouderaManagerInfoV4Response clouderaManagerInfoJson620 = new ClouderaManagerInfoV4Response();
clouderaManagerInfoJson620.setVersion("6.2.0");
clouderaManagerInfoJson620.setRepository(RepoTestUtil.getClouderaManagerRepositoryResponse("6.2.0"));
ClouderaManagerStackDescriptorV4Response cdhDescriptor610 = new ClouderaManagerStackDescriptorV4Response();
cdhDescriptor610.setClouderaManager(clouderaManagerInfoJson610);
cdhMap.put("6.1.0", cdhDescriptor610);
ClouderaManagerStackDescriptorV4Response cdhDescriptor620 = new ClouderaManagerStackDescriptorV4Response();
cdhDescriptor620.setClouderaManager(clouderaManagerInfoJson620);
cdhMap.put("6.2.0", cdhDescriptor620);
stackMatrixV4Response.setCdh(cdhMap);
when(stackMatrixService.getStackMatrix(null)).thenReturn(stackMatrixV4Response);
}
Aggregations