Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: show latest certificates #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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