Fixing an issue were aws certificates plugins might not have a chain. (#512)
This commit is contained in:
parent
2130029f90
commit
a616310eb7
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue