updated query to ignore empty parameters
This commit is contained in:
parent
afc7512914
commit
a50d80992c
|
@ -238,17 +238,7 @@ def reissue(old_certificate_name, commit):
|
||||||
|
|
||||||
if not old_cert:
|
if not old_cert:
|
||||||
for certificate in get_all_pending_reissue():
|
for certificate in get_all_pending_reissue():
|
||||||
try:
|
|
||||||
request_reissue(certificate, commit)
|
request_reissue(certificate, commit)
|
||||||
except Exception as e:
|
|
||||||
sentry.captureException()
|
|
||||||
current_app.logger.exception(
|
|
||||||
"Error reissuing certificate: {}".format(certificate.name), exc_info=True)
|
|
||||||
print(
|
|
||||||
"[!] Failed to reissue certificates. Reason: {}".format(
|
|
||||||
e
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
request_reissue(old_cert, commit)
|
request_reissue(old_cert, commit)
|
||||||
|
|
||||||
|
@ -275,7 +265,7 @@ def query(fqdns, issuer, owner, expired):
|
||||||
table = []
|
table = []
|
||||||
|
|
||||||
q = database.session_query(Certificate)
|
q = database.session_query(Certificate)
|
||||||
|
if issuer:
|
||||||
sub_query = database.session_query(Authority.id) \
|
sub_query = database.session_query(Authority.id) \
|
||||||
.filter(Authority.name.ilike('%{0}%'.format(issuer))) \
|
.filter(Authority.name.ilike('%{0}%'.format(issuer))) \
|
||||||
.subquery()
|
.subquery()
|
||||||
|
@ -286,12 +276,13 @@ def query(fqdns, issuer, owner, expired):
|
||||||
Certificate.authority_id.in_(sub_query)
|
Certificate.authority_id.in_(sub_query)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if owner:
|
||||||
q = q.filter(Certificate.owner.ilike('%{0}%'.format(owner)))
|
q = q.filter(Certificate.owner.ilike('%{0}%'.format(owner)))
|
||||||
|
|
||||||
if not expired:
|
if not expired:
|
||||||
q = q.filter(Certificate.expired == False) # noqa
|
q = q.filter(Certificate.expired == False) # noqa
|
||||||
|
|
||||||
|
if fqdns:
|
||||||
for f in fqdns.split(','):
|
for f in fqdns.split(','):
|
||||||
q = q.filter(
|
q = q.filter(
|
||||||
or_(
|
or_(
|
||||||
|
@ -373,9 +364,6 @@ def check_revoked():
|
||||||
else:
|
else:
|
||||||
status = verify_string(cert.body, "")
|
status = verify_string(cert.body, "")
|
||||||
|
|
||||||
if status is None:
|
|
||||||
cert.status = 'unknown'
|
|
||||||
else:
|
|
||||||
cert.status = 'valid' if status else 'revoked'
|
cert.status = 'valid' if status else 'revoked'
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue