use of com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations in project cloudbreak by hortonworks.
the class BlueprintTextProcessor method convertTextToConfiguration.
private SiteConfigurations convertTextToConfiguration(String config) {
try {
SiteConfigurations result = SiteConfigurations.getEmptyConfiguration();
ObjectNode root = (ObjectNode) JsonUtil.readTree(config);
for (Iterator<Map.Entry<String, JsonNode>> sites = root.fields(); sites.hasNext(); ) {
Map.Entry<String, JsonNode> site = sites.next();
ObjectNode siteNode = (ObjectNode) site.getValue();
JsonNode properties = siteNode.findValue(PROPERTIES_NODE);
if (properties != null) {
siteNode = (ObjectNode) properties;
}
Map<String, String> siteprops = new HashMap<>();
for (Iterator<Map.Entry<String, JsonNode>> props = siteNode.fields(); props.hasNext(); ) {
Map.Entry<String, JsonNode> prop = props.next();
siteprops.put(prop.getKey(), prop.getValue().textValue());
}
if (!siteprops.isEmpty()) {
result.addSiteConfiguration(site.getKey(), siteprops);
}
}
return result;
} catch (IOException e) {
throw new BlueprintProcessingException("Failed to parse configuration ('" + config + "').", e);
}
}
use of com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations 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;
}
use of com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations in project cloudbreak by hortonworks.
the class KerberosBlueprintService method extendBlueprintWithKerberos.
public BlueprintTextProcessor extendBlueprintWithKerberos(BlueprintTextProcessor blueprint, Map<String, String> kerberosEnv, String domains, Boolean useUdp, Integer kpropPort, boolean forced) {
try {
String krb5Config = FileReaderUtils.readFileFromClasspath("kerberos/krb5-conf-template.conf");
krb5Config = krb5Config.replaceAll("udp_preference_limit_content", useUdp ? "0" : "1");
if (kpropPort != null) {
krb5Config = krb5Config.replaceAll("iprop_enable_content", "true");
krb5Config = krb5Config.replaceAll("iprop_port_content", kpropPort.toString());
} else {
krb5Config = krb5Config.replaceAll("iprop_enable_content", "false");
krb5Config = krb5Config.replaceAll("iprop_port_content", "8888");
}
SiteConfigurations configs = SiteConfigurations.getEmptyConfiguration();
Map<String, String> krb5Conf = new HashMap<>();
krb5Conf.put("domains", domains);
krb5Conf.put("manage_krb5_conf", "true");
if (!useUdp || kpropPort != null) {
krb5Conf.put("content", krb5Config.toString());
}
configs.addSiteConfiguration("kerberos-env", kerberosEnv);
configs.addSiteConfiguration("krb5-conf", krb5Conf);
return blueprint.addComponentToHostgroups("KERBEROS_CLIENT", hg -> true).setSecurityType("KERBEROS").extendBlueprintGlobalConfiguration(configs, forced);
} catch (IOException e) {
throw new BlueprintProcessingException("Failed to extend blueprint with kerberos configurations.", e);
}
}
Aggregations