use of com.sequenceiq.cloudbreak.core.CloudbreakSecuritySetupException in project cloudbreak by hortonworks.
the class HostMetadataSetup method updateWithHostData.
private void updateWithHostData(Stack stack, Collection<InstanceMetaData> metadataToUpdate) throws CloudbreakSecuritySetupException {
try {
List<String> privateIps = metadataToUpdate.stream().map(InstanceMetaData::getPrivateIp).collect(Collectors.toList());
GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
Map<String, String> members = hostOrchestrator.getMembers(gatewayConfig, privateIps);
LOGGER.info("Received host names from hosts: {}, original targets: {}", members.values(), privateIps);
for (InstanceMetaData instanceMetaData : metadataToUpdate) {
instanceMetaData.setConsulServer(false);
String address = members.get(instanceMetaData.getPrivateIp());
instanceMetaData.setDiscoveryFQDN(address);
LOGGER.info("Domain used for instance: {} original: {}, fqdn: {}", instanceMetaData.getInstanceId(), address, instanceMetaData.getDiscoveryFQDN());
}
} catch (Exception e) {
throw new CloudbreakSecuritySetupException(e);
}
}
Aggregations