Search in sources :

Example 1 with CloudbreakSecuritySetupException

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);
    }
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.InstanceMetaData) HostOrchestrator(com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator) CloudbreakSecuritySetupException(com.sequenceiq.cloudbreak.core.CloudbreakSecuritySetupException) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) CloudbreakSecuritySetupException(com.sequenceiq.cloudbreak.core.CloudbreakSecuritySetupException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Aggregations

CloudbreakSecuritySetupException (com.sequenceiq.cloudbreak.core.CloudbreakSecuritySetupException)1 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)1 HostOrchestrator (com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator)1 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)1 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)1