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:
"""
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):

View File

@ -858,8 +858,8 @@ class Sources(Command):
Defines a set of actions to take against Lemur's sources.
"""
option_list = (
Option('-s', '--sources', dest='source_strings', action='append', help='Sources to operate on.'),
Option('-a', '--action', choices=['sync', 'clean'], dest='action', help='Action to take on source.')
Option('-s', '--sources', dest='source_strings', action='append', help='Sources to operate on.', required=True),
Option('-a', '--action', choices=['sync', 'clean'], dest='action', help='Action to take on source.', required=True)
)
def run(self, source_strings, action):

View File

@ -94,4 +94,4 @@ def digest_aws_cert_response(response):
if 'certificate_chain' in cert:
chain = cert['certificate_chain']
return str(body), str(chain),
return body, chain