Fixing issue where we were seeing AWS API errors due to certificates not having private keys and could not be uploaded or 'synced'
This commit is contained in:
parent
a0d50ef03a
commit
5482bbf4bd
|
@ -43,15 +43,18 @@ class AWSDestinationPlugin(DestinationPlugin):
|
||||||
# }
|
# }
|
||||||
|
|
||||||
def upload(self, name, body, private_key, cert_chain, options, **kwargs):
|
def upload(self, name, body, private_key, cert_chain, options, **kwargs):
|
||||||
try:
|
if private_key:
|
||||||
iam.upload_cert(find_value('accountNumber', options), name, body, private_key, cert_chain=cert_chain)
|
try:
|
||||||
except BotoServerError as e:
|
iam.upload_cert(find_value('accountNumber', options), name, body, private_key, cert_chain=cert_chain)
|
||||||
if e.error_code != 'EntityAlreadyExists':
|
except BotoServerError as e:
|
||||||
raise Exception(e)
|
if e.error_code != 'EntityAlreadyExists':
|
||||||
|
raise Exception(e)
|
||||||
|
|
||||||
e = find_value('elb', options)
|
e = find_value('elb', options)
|
||||||
if e:
|
if e:
|
||||||
elb.attach_certificate(kwargs['accountNumber'], ['region'], e['name'], e['port'], e['certificateId'])
|
elb.attach_certificate(kwargs['accountNumber'], ['region'], e['name'], e['port'], e['certificateId'])
|
||||||
|
else:
|
||||||
|
raise Exception("Unable to upload to AWS, private key is required")
|
||||||
|
|
||||||
|
|
||||||
class AWSSourcePlugin(SourcePlugin):
|
class AWSSourcePlugin(SourcePlugin):
|
||||||
|
|
|
@ -76,7 +76,7 @@ def sync(labels=None):
|
||||||
if source.label not in labels:
|
if source.label not in labels:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
current_app.logger.error("Retrieving certificates from {0}".format(source.label))
|
current_app.logger.debug("Retrieving certificates from {0}".format(source.label))
|
||||||
s = plugins.get(source.plugin_name)
|
s = plugins.get(source.plugin_name)
|
||||||
certificates = s.get_certificates(source.options)
|
certificates = s.get_certificates(source.options)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue