use of com.sequenceiq.freeipa.client.RetryableFreeIpaClientException in project cloudbreak by hortonworks.
the class ServiceKeytabService method addAndSetupService.
private com.sequenceiq.freeipa.client.model.Service addAndSetupService(ServiceKeytabRequest request, String realm, FreeIpaClient ipaClient) throws FreeIpaClientException, KeytabCreationException {
String canonicalPrincipal = keytabCommonService.constructPrincipal(request.getServiceName(), request.getServerHostName(), realm);
try {
com.sequenceiq.freeipa.client.model.Service service = createOrGetService(canonicalPrincipal, ipaClient);
addAliasToService(request, realm, ipaClient, canonicalPrincipal, service);
allowServiceKeytabRetrieval(service.getKrbcanonicalname(), ipaClient);
roleComponent.addRoleAndPrivileges(Optional.of(service), Optional.empty(), request.getRoleRequest(), ipaClient);
return service;
} catch (RetryableFreeIpaClientException e) {
LOGGER.error(SERVICE_PRINCIPAL_CREATION_FAILED + ' ' + e.getLocalizedMessage(), e);
throw new RetryableFreeIpaClientException(SERVICE_PRINCIPAL_CREATION_FAILED, e, new KeytabCreationException(SERVICE_PRINCIPAL_CREATION_FAILED));
} catch (FreeIpaClientException e) {
LOGGER.error(SERVICE_PRINCIPAL_CREATION_FAILED + ' ' + e.getLocalizedMessage(), e);
throw new KeytabCreationException(SERVICE_PRINCIPAL_CREATION_FAILED);
}
}
Aggregations