Skip to content

Commit

Permalink
replace like with is none check if cn is none
Browse files Browse the repository at this point in the history
  • Loading branch information
charhate committed Nov 27, 2024
1 parent 301a90a commit ffaebc0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lemur/certificates/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ def get_certificates_with_same_cn_with_rotate_on(cn, date_created):
date_created_max = date_created.ceil('day')

query = database.session_query(Certificate)\
.filter(Certificate.cn.like(cn))\
.filter(Certificate.rotation == true())\
.filter(Certificate.not_after >= now)\
.filter(Certificate.date_created >= date_created_min)\
.filter(Certificate.date_created <= date_created_max)\
.filter(not_(Certificate.replaced.any()))

if cn is not None:
query = query.filter(Certificate.cn.like(cn))
else:
query = query.filter(Certificate.cn.is_(None))

return query.all()


Expand Down

0 comments on commit ffaebc0

Please sign in to comment.