Skip to content

Commit

Permalink
Merge pull request #5019 from Netflix/cn-check
Browse files Browse the repository at this point in the history
replace like with is none check if cn is none
  • Loading branch information
charhate authored Dec 2, 2024
2 parents 301a90a + ffaebc0 commit 08e58ae
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 08e58ae

Please sign in to comment.