mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Rewrap errors in get_principal to CCacheError
Causes nicer error message when kerberos credentials are not available. https://fedorahosted.org/freeipa/ticket/5272 Reviewed-By: David Kupka <dkupka@redhat.com> Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
cfeea91828
commit
bdccebbcdb
@@ -173,9 +173,15 @@ def get_principal(ccache_name=None):
|
||||
default
|
||||
:returns:
|
||||
Default principal name as string
|
||||
:raises:
|
||||
errors.CCacheError if the principal cannot be retrieved from given
|
||||
ccache
|
||||
'''
|
||||
creds = get_credentials(ccache_name=ccache_name)
|
||||
return unicode(creds.name)
|
||||
try:
|
||||
creds = get_credentials(ccache_name=ccache_name)
|
||||
return unicode(creds.name)
|
||||
except gssapi.exceptions.GSSError as e:
|
||||
raise errors.CCacheError(message=unicode(e))
|
||||
|
||||
def get_credentials_if_valid(name=None, ccache_name=None):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user