Ensuring that we don't fail cleaning if it doesn't exist. (#708)

This commit is contained in:
kevgliss 2017-03-03 16:03:52 -08:00 committed by GitHub
parent c46fa5d69c
commit b715687617
1 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,9 @@ def retry_throttled(exception):
if exception.response['Error']['Code'] == 'NoSuchEntity':
return False
if isinstance(exception, botocore.errorfactory.NoSuchEntityException):
return False
metrics.send('iam_retry', 'counter', 1)
return True
@ -93,7 +96,11 @@ def delete_cert(cert_name, **kwargs):
:return:
"""
client = kwargs.pop('client')
client.delete_server_certificate(ServerCertificateName=cert_name)
try:
client.delete_server_certificate(ServerCertificateName=cert_name)
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] != 'NoSuchEntity':
raise e
@sts_client('iam')