use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.
the class RangerRazDatalakeConfigProvider method getAdditionalServices.
@Override
public Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) {
if (isConfigurationNeeded(cmTemplateProcessor, source)) {
ApiClusterTemplateService coreSettings = createTemplate();
Set<HostgroupView> hostgroupViews = source.getHostgroupViews();
return hostgroupViews.stream().filter(hg -> hg.getName().toLowerCase().equals("master")).collect(Collectors.toMap(HostgroupView::getName, v -> coreSettings));
}
return Map.of();
}
use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.
the class GeneratedCmTemplateService method prepareClouderaManagerTemplate.
public GeneratedCmTemplate prepareClouderaManagerTemplate(Set<String> services, String stackType, String version, String uuid) {
CmTemplateProcessor processor = initiateTemplate();
Set<ServiceConfig> serviceConfigs = collectServiceConfigs(services);
Map<String, Set<String>> hostServiceMap = new HashMap<>();
prepareCdhVersion(stackType, version, processor);
processor.setDisplayName(prepareDisplayName(uuid));
processor.setServices(prepareApiClusterTemplateServices(serviceConfigs, hostServiceMap));
processor.setHostTemplates(prepareApiClusterTemplateHostTemplates(hostServiceMap));
return new GeneratedCmTemplate(prepareTemplate(processor));
}
use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.
the class OpdbServiceEndpointCollectorTest method mockTemplateComponents.
private void mockTemplateComponents() {
CmTemplateProcessor cmTemplateProcessor = mock(CmTemplateProcessor.class);
when(cmTemplateProcessorFactory.get(any())).thenReturn(cmTemplateProcessor);
when(cmTemplateProcessor.getAllComponents()).thenReturn(new HashSet<>(Arrays.asList(ServiceComponent.of("HBASE", "MASTER"), ServiceComponent.of("HBASE", "REGIONSERVER"), ServiceComponent.of("HBASE", "HBASERESTSERVER"), ServiceComponent.of("PHOENIX", "PHOENIX_QUERY_SERVER"), ServiceComponent.of("CLOUDERA_MANAGER", "CM-API"), ServiceComponent.of("CLOUDERA_MANAGER_UI", "CM-UI"))));
}
use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method mockBlueprintTextProcessor.
private void mockBlueprintTextProcessor() {
Blueprint blueprint = new Blueprint();
blueprint.setBlueprintText("{\"Blueprints\":{}}");
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
blueprint.setWorkspace(workspace);
when(blueprintService.getByNameForWorkspaceId(any(), anyLong())).thenReturn(blueprint);
CmTemplateProcessor cmTemplateProcessor = mock(CmTemplateProcessor.class);
when(cmTemplateProcessorFactory.get(any())).thenReturn(cmTemplateProcessor);
}
use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildInstanceGroups.
private List<Group> buildInstanceGroups(Stack stack, List<InstanceGroup> instanceGroups, StackAuthentication stackAuthentication, Collection<String> deleteRequests, DetailedEnvironmentResponse environment) {
// sort by name to avoid shuffling the different instance groups
Collections.sort(instanceGroups);
List<Group> groups = new ArrayList<>();
Cluster cluster = stack.getCluster();
if (cluster != null) {
String blueprintText = cluster.getBlueprint() != null ? cluster.getBlueprint().getBlueprintText() : cluster.getExtendedBlueprintText();
if (blueprintText != null) {
CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(blueprintText);
Map<String, Set<String>> componentsByHostGroup = cmTemplateProcessor.getComponentsByHostGroup();
Map<String, String> userDefinedTags = getUserDefinedTags(stack);
for (InstanceGroup instanceGroup : instanceGroups) {
if (instanceGroup.getTemplate() != null) {
InstanceAuthentication instanceAuthentication = buildInstanceAuthentication(stackAuthentication);
Optional<CloudFileSystemView> cloudFileSystemView = cloudFileSystemViewProvider.getCloudFileSystemView(cluster.getFileSystem(), componentsByHostGroup, instanceGroup);
groups.add(new Group(instanceGroup.getGroupName(), instanceGroup.getInstanceGroupType(), buildCloudInstances(environment, stackAuthentication, deleteRequests, instanceGroup), buildSecurity(instanceGroup), buildCloudInstanceSkeleton(environment, stackAuthentication, instanceGroup), getFields(instanceGroup), instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey(), getRootVolumeSize(instanceGroup), cloudFileSystemView, buildDeletedCloudInstances(environment, stackAuthentication, instanceGroup), buildGroupNetwork(stack.getNetwork(), instanceGroup), userDefinedTags));
}
}
}
} else {
LOGGER.warn("Cluster or blueprint is null for stack id:[{}] name:[{}]", stack.getId(), stack.getName());
}
return groups;
}
Aggregations