Search in sources :

Example 11 with RetryableFreeIpaClientException

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);
    }
}
Also used : RetryableFreeIpaClientException(com.sequenceiq.freeipa.client.RetryableFreeIpaClientException) KeytabCreationException(com.sequenceiq.freeipa.kerberosmgmt.exception.KeytabCreationException) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) RetryableFreeIpaClientException(com.sequenceiq.freeipa.client.RetryableFreeIpaClientException)

Aggregations

FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)11 RetryableFreeIpaClientException (com.sequenceiq.freeipa.client.RetryableFreeIpaClientException)11 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)6 KeytabCreationException (com.sequenceiq.freeipa.kerberosmgmt.exception.KeytabCreationException)5 Test (org.junit.jupiter.api.Test)3 AddDnsZoneForSubnetsResponse (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsZoneForSubnetsResponse)2 Host (com.sequenceiq.freeipa.client.model.Host)2 Keytab (com.sequenceiq.freeipa.client.model.Keytab)2 Stack (com.sequenceiq.freeipa.entity.Stack)2 RequestListener (com.googlecode.jsonrpc4j.JsonRpcClient.RequestListener)1 ServiceFamilies (com.sequenceiq.cloudbreak.ccm.endpoint.ServiceFamilies)1 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)1 ClusterProxyConfiguration (com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyConfiguration)1 MDCBuilder (com.sequenceiq.cloudbreak.logger.MDCBuilder)1 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)1 RoleRequest (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.RoleRequest)1 ClusterProxyErrorRpcListener (com.sequenceiq.freeipa.client.ClusterProxyErrorRpcListener)1 FreeIpaClientBuilder (com.sequenceiq.freeipa.client.FreeIpaClientBuilder)1 FreeIpaHostNotAvailableException (com.sequenceiq.freeipa.client.FreeIpaHostNotAvailableException)1 InvalidFreeIpaStateException (com.sequenceiq.freeipa.client.InvalidFreeIpaStateException)1