use of com.sequenceiq.freeipa.entity.FreeIpa in project cloudbreak by hortonworks.
the class FreeIpaDescribeService method getResponseForStack.
private DescribeFreeIpaResponse getResponseForStack(Stack stack, Boolean includeAllInstances) {
MDCBuilder.buildMdcContext(stack);
ImageEntity image = imageService.getByStack(stack);
FreeIpa freeIpa = freeIpaService.findByStackId(stack.getId());
Optional<UserSyncStatus> userSyncStatus = userSyncStatusService.findByStack(stack);
return stackToDescribeFreeIpaResponseConverter.convert(stack, image, freeIpa, userSyncStatus, includeAllInstances);
}
use of com.sequenceiq.freeipa.entity.FreeIpa in project cloudbreak by hortonworks.
the class AbstractFreeIpaCleanupAction method createFlowContext.
@Override
protected FreeIpaContext createFlowContext(FlowParameters flowParameters, StateContext<FreeIpaCleanupState, FreeIpaCleanupEvent> stateContext, P payload) {
FreeIpa freeIpa = freeIpaService.findByStackId(payload.getResourceId());
MDCBuilder.addOperationId(payload.getOperationId());
return new FreeIpaContext(flowParameters, freeIpa);
}
use of com.sequenceiq.freeipa.entity.FreeIpa in project cloudbreak by hortonworks.
the class FreeIpaConfigService method createFreeIpaConfigs.
public FreeIpaConfigView createFreeIpaConfigs(Stack stack, Set<Node> hosts) {
final FreeIpaConfigView.Builder builder = new FreeIpaConfigView.Builder();
FreeIpa freeIpa = freeIpaService.findByStack(stack);
Multimap<String, String> subnetWithCidr = networkService.getFilteredSubnetWithCidr(stack);
LOGGER.debug("Subnets for reverse zone calculation : {}", subnetWithCidr);
String reverseZones = reverseDnsZoneCalculator.reverseDnsZoneForCidrs(subnetWithCidr.values());
LOGGER.debug("Reverse zones : {}", reverseZones);
return builder.withRealm(freeIpa.getDomain().toUpperCase()).withDomain(freeIpa.getDomain()).withPassword(freeIpa.getAdminPassword()).withDnssecValidationEnabled(isDnsSecValidationEnabled(stack.getCloudPlatform())).withReverseZones(reverseZones).withAdminUser(freeIpaClientFactory.getAdminUser()).withFreeIpaToReplicate(gatewayConfigService.getPrimaryGatewayConfig(stack)).withHosts(hosts).withBackupConfig(determineAndSetBackup(stack)).withCcmv2Enabled(stack.getTunnel().useCcmV2OrJumpgate()).withCidrBlocks(stack.getNetwork().getNetworkCidrs()).withCcmv2JumpgateEnabled(stack.getTunnel().useCcmV2Jumpgate()).build();
}
use of com.sequenceiq.freeipa.entity.FreeIpa in project cloudbreak by hortonworks.
the class DnsRecordService method createFreeIpaAndClient.
private FreeIpaAndClient createFreeIpaAndClient(String environmentCrn, String accountId) throws FreeIpaClientException {
Stack stack = stackService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId);
MDCBuilder.buildMdcContext(stack);
FreeIpa freeIpa = freeIpaService.findByStack(stack);
FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack);
return new FreeIpaAndClient(freeIpa, freeIpaClient);
}
use of com.sequenceiq.freeipa.entity.FreeIpa in project cloudbreak by hortonworks.
the class FreeIpaClientFactory method getFreeIpaClient.
private FreeIpaClient getFreeIpaClient(Stack stack, boolean withPing, boolean forceCheckUnreachable, Optional<String> freeIpaFqdn) throws FreeIpaClientException {
stack = stackService.getByIdWithListsInTransaction(stack.getId());
Status stackStatus = stack.getStackStatus().getStatus();
if (forceCheckUnreachable || !stackStatus.isFreeIpaUnreachableStatus()) {
try {
Optional<FreeIpaClient> client = Optional.empty();
if (clusterProxyService.isCreateConfigForClusterProxy(stack)) {
return getFreeIpaClientBuilderForClusterProxy(stack, freeIpaFqdn).build(withPing);
} else {
List<InstanceMetaData> instanceMetaDatas = getPriorityOrderedFreeIpaInstances(stack, forceCheckUnreachable).stream().filter(instanceMetaData -> freeIpaFqdn.isEmpty() || freeIpaFqdn.get().equals(instanceMetaData.getDiscoveryFQDN())).collect(Collectors.toList());
for (Iterator<InstanceMetaData> instanceIterator = instanceMetaDatas.iterator(); instanceIterator.hasNext() && client.isEmpty(); ) {
InstanceMetaData instanceMetaData = instanceIterator.next();
client = getFreeIpaClientForDirectConnect(stack, instanceMetaData, withPing, !instanceIterator.hasNext());
}
}
return client.orElseThrow(() -> new FreeIpaHostNotAvailableException("No FreeIPA client was available"));
} catch (RetryableFreeIpaClientException e) {
throw createFreeIpaUnableToBuildClient(e);
} catch (Exception e) {
throw createFreeIpaUnableToBuildClient(e);
}
} else {
throw createFreeIpaStateIsInvalidException(stackStatus);
}
}
Aggregations