use of com.sequenceiq.cloudbreak.blueprint.configuration.HostgroupConfigurations in project cloudbreak by hortonworks.
the class BlueprintTextProcessor method extendBlueprintHostGroupConfiguration.
public BlueprintTextProcessor extendBlueprintHostGroupConfiguration(HostgroupConfigurations hostGroupConfig, boolean forced) {
ArrayNode configurations = getArrayFromNodeByNodeName(blueprint, CONFIGURATIONS_NODE);
ArrayNode hostgroups = getArrayFromObjectNodeByPath(blueprint, HOST_GROUPS_NODE);
HostgroupConfigurations filteredConfiguraitons = hostGroupConfig.getFilteredConfigs(getExistingParametersFromGlobals(configurations), forced);
for (HostgroupConfiguration filteredConfig : filteredConfiguraitons) {
ObjectNode hostgroup = getHostgroup(hostgroups, filteredConfig.getName());
JsonNode hostgroupConfig = hostgroup.path(CONFIGURATIONS_NODE);
if (hostgroupConfig.isMissingNode()) {
ArrayNode hostgroupConfigs = hostgroup.putArray(CONFIGURATIONS_NODE);
for (SiteConfiguration e : filteredConfig.getSiteConfigs()) {
addSiteToHostgroupConfiguration(hostgroupConfigs, e.getName(), e.getProperties());
}
} else {
for (SiteConfiguration e : filteredConfig.getSiteConfigs()) {
ArrayNode hostgroupConfigs = (ArrayNode) hostgroupConfig;
String siteName = e.getName();
ObjectNode site = (ObjectNode) hostgroupConfigs.findValue(siteName);
if (site == null) {
addSiteToHostgroupConfiguration(hostgroupConfigs, siteName, e.getProperties());
} else {
ObjectNode objectToModify = (ObjectNode) site.get(PROPERTIES_NODE);
if (objectToModify == null) {
objectToModify = site;
}
putAllObjects(objectToModify, e.getProperties(), forced);
}
}
}
}
return this;
}
use of com.sequenceiq.cloudbreak.blueprint.configuration.HostgroupConfigurations in project cloudbreak by hortonworks.
the class HadoopConfigurationService method customTextManipulation.
@Override
public BlueprintTextProcessor customTextManipulation(BlueprintPreparationObject source, BlueprintTextProcessor blueprintProcessor) {
Map<String, Map<String, Map<String, String>>> hostGroupConfig = configService.getHostGroupConfiguration(blueprintProcessor, source.getHostgroupViews());
HostgroupConfigurations hostgroupConfigurations = HostgroupConfigurations.fromMap(hostGroupConfig);
blueprintProcessor.extendBlueprintHostGroupConfiguration(hostgroupConfigurations, false);
Map<String, Map<String, String>> globalConfig = getGlobalConfiguration(blueprintProcessor, source.getHostgroupViews());
SiteConfigurations siteConfigurations = SiteConfigurations.fromMap(globalConfig);
blueprintProcessor.extendBlueprintGlobalConfiguration(siteConfigurations, false);
return blueprintProcessor;
}
Aggregations