Fixing an issue were aws certificates plugins might not have a chain. (#512)

This commit is contained in:
kevgliss
2016-11-17 14:47:10 -08:00
committed by GitHub
parent 2130029f90
commit a616310eb7
4 changed files with 8 additions and 5 deletions

View File

@ -160,7 +160,7 @@ class CertificateUploadInputSchema(CertificateCreationSchema):
private_key = fields.String(validate=validators.private_key)
body = fields.String(required=True, validate=validators.public_certificate)
chain = fields.String(validate=validators.public_certificate) # TODO this could be multiple certificates
chain = fields.String(validate=validators.public_certificate, missing=None) # TODO this could be multiple certificates
destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)

View File

@ -86,7 +86,10 @@ def find_duplicates(cert):
:param cert:
:return:
"""
return Certificate.query.filter_by(body=cert['body'].strip(), chain=cert['chain'].strip()).all()
if cert.get('chain'):
return Certificate.query.filter_by(body=cert['body'].strip(), chain=cert['chain'].strip()).all()
else:
return Certificate.query.filter_by(body=cert['body'].strip(), chain=None).all()
def export(cert, export_plugin):