Source syncing tweaks. (#705)

* Allow owner to be specified when syncing certs.

* Ensuring non-endpoint plugins don't fail to complete syncing.

* Adding in some additional error handling.
This commit is contained in:
kevgliss 2017-03-03 14:53:56 -08:00 committed by GitHub
parent d53f64890c
commit fc957b63ff
4 changed files with 8 additions and 5 deletions

View File

@ -205,7 +205,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, missing=None) # TODO this could be multiple certificates
chain = fields.String(validate=validators.public_certificate, missing=None, allow_none=True) # TODO this could be multiple certificates
destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True)
notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True)

View File

@ -147,7 +147,7 @@ def domains(cert):
for entry in entries:
domains.append(entry)
except Exception as e:
current_app.logger.warning("Failed to get SubjectAltName: {0}".format(e))
pass
return domains

View File

@ -20,7 +20,8 @@ def public_certificate(body):
"""
try:
parse_certificate(body)
except Exception:
except Exception as e:
current_app.logger.exception(e)
raise ValidationError('Public certificate presented is not valid.')

View File

@ -67,7 +67,7 @@ def sync_endpoints(source):
endpoints = s.get_endpoints(source.options)
except NotImplementedError:
current_app.logger.warning("Unable to sync endpoints for source {0} plugin has not implemented 'get_endpoints'".format(source.label))
return
return new, updated
for endpoint in endpoints:
exists = endpoint_service.get_by_dnsname(endpoint['dnsname'])
@ -114,7 +114,9 @@ def sync_certificates(source, user):
for certificate in certificates:
exists = certificate_service.get_by_name(certificate['name'])
certificate['owner'] = user.email
if not certificate.get('owner'):
certificate['owner'] = user.email
certificate['creator'] = user
if not exists: