Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ca_manager/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,10 @@ def __iter__(self):
Iterate over all certificate request in OUTPUT_PATH
"""
return Certificate.select().iterator()

def latest(self, n=5):
"""
Get the latest n certificates; default n=5
"""

return Certificate.select().order_by(-Certificate.date_issued).limit(n)
3 changes: 3 additions & 0 deletions ca_manager/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class CAManagerShell(cmd.Cmd):
def __init__(self, ca_manager):
super(CAManagerShell, self).__init__()
self.ca_manager = ca_manager
self.intro += "Latest certs signed:\n\n"
for cert in self.ca_manager.certificate.latest():
self.intro += "%s\n" % (cert,)

def do_ls_cas(self, l):
'List the available certification authorities: LS_CA'
Expand Down