mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add NSSDatabase.has_nickname for checking nickname presence in a NSS DB
https://fedorahosted.org/freeipa/ticket/4416 Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
017d61dbfb
commit
e7b749224c
@ -406,6 +406,15 @@ class NSSDatabase(object):
|
|||||||
raise RuntimeError("Failed to get %s" % nickname)
|
raise RuntimeError("Failed to get %s" % nickname)
|
||||||
return cert
|
return cert
|
||||||
|
|
||||||
|
def has_nickname(self, nickname):
|
||||||
|
try:
|
||||||
|
self.get_cert(nickname)
|
||||||
|
except RuntimeError:
|
||||||
|
# This might be error other than "nickname not found". Beware.
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def export_pem_cert(self, nickname, location):
|
def export_pem_cert(self, nickname, location):
|
||||||
"""Export the given cert to PEM file in the given location"""
|
"""Export the given cert to PEM file in the given location"""
|
||||||
cert = self.get_cert(nickname)
|
cert = self.get_cert(nickname)
|
||||||
|
Loading…
Reference in New Issue
Block a user