[freeipa PR#5813][opened] krb_utils: Simplify get_credentials
by stanislavlevin
URL: https://github.com/freeipa/freeipa/pull/5813
Author: stanislavlevin
Title: #5813: krb_utils: Simplify get_credentials
Action: opened
PR body:
"""
Previously, `get_credentials` raises either `ValueError` or re-raises `GSSError`. The former makes the handling of this function more difficult without a good reason.
With this change:
- `get_credentials` no longer handles exceptions by itself, but delegates
this to the callers (which already process GSS errors).
- `get_credentials_if_valid` doesn't raise any expected exceptions, but
return valid credentials (on the moment of calling) or None. This makes
it consistent with docs.
Related: https://pagure.io/freeipa/issue/8873
tested scenarios:
1. missing creds && ipa user-find xxx
2. expired creds && ipa user-find xxx
3. https://pagure.io/freeipa/issue/7752 (removed ccache on server + ipa user-find xxx)
4. ccache sweeper
"""
To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5813/head:pr5813
git checkout pr5813
2 years, 10 months