Search in sources :

Example 1 with FreeIpaClientExceptionWrapper

use of com.sequenceiq.freeipa.client.FreeIpaClientExceptionWrapper in project cloudbreak by hortonworks.

the class KerberosMgmtRoleComponent method doesPrivilegeExist.

private boolean doesPrivilegeExist(FreeIpaClient ipaClient, String privilegeName) {
    try {
        ipaClient.showPrivilege(privilegeName);
        LOGGER.debug("Privilege [{}] exists", privilegeName);
        return true;
    } catch (FreeIpaClientException e) {
        if (FreeIpaClientExceptionUtil.isNotFoundException(e)) {
            LOGGER.debug("Privilege [{}] does not exist", privilegeName);
            return false;
        } else {
            LOGGER.error("Privilege [{}] show error", privilegeName, e);
            throw new FreeIpaClientExceptionWrapper(e);
        }
    }
}
Also used : FreeIpaClientExceptionWrapper(com.sequenceiq.freeipa.client.FreeIpaClientExceptionWrapper) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException)

Example 2 with FreeIpaClientExceptionWrapper

use of com.sequenceiq.freeipa.client.FreeIpaClientExceptionWrapper in project cloudbreak by hortonworks.

the class RootCertRegisterService method register.

@Override
@Retryable(value = RetryableFreeIpaClientException.class, maxAttemptsExpression = RetryableFreeIpaClientException.MAX_RETRIES_EXPRESSION, backoff = @Backoff(delayExpression = RetryableFreeIpaClientException.DELAY_EXPRESSION, multiplierExpression = RetryableFreeIpaClientException.MULTIPLIER_EXPRESSION))
public void register(Long stackId) {
    try {
        Stack stack = stackService.getStackById(stackId);
        registerInternal(stack);
    } catch (FreeIpaClientException e) {
        LOGGER.error("Couldn't get FreeIPA CA certificate", e);
        throw new FreeIpaClientExceptionWrapper(e);
    }
}
Also used : FreeIpaClientExceptionWrapper(com.sequenceiq.freeipa.client.FreeIpaClientExceptionWrapper) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) RetryableFreeIpaClientException(com.sequenceiq.freeipa.client.RetryableFreeIpaClientException) Stack(com.sequenceiq.freeipa.entity.Stack) Retryable(org.springframework.retry.annotation.Retryable)

Aggregations

FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 FreeIpaClientExceptionWrapper (com.sequenceiq.freeipa.client.FreeIpaClientExceptionWrapper)2 RetryableFreeIpaClientException (com.sequenceiq.freeipa.client.RetryableFreeIpaClientException)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 Retryable (org.springframework.retry.annotation.Retryable)1