Add better handling for errors causing integration test instability (#40184)

* Add better handling for errors causing integration test instability
pull/40190/merge
Ryan Brown 7 years ago committed by Sloane Hertel
parent 0dc73e7822
commit ede47910f8

@ -131,7 +131,7 @@ except ImportError:
HAS_BOTO3 = False
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import (boto3_conn, camel_dict_to_snake_dict,
from ansible.module_utils.ec2 import (boto3_conn, AWSRetry, camel_dict_to_snake_dict,
ec2_argument_spec, get_aws_connection_info)
@ -148,6 +148,7 @@ class Ec2CustomerGatewayManager:
except ClientError as e:
module.fail_json(msg=e.message)
@AWSRetry.jittered_backoff(delay=2, max_delay=30, retries=6, catch_extra_error_codes=['IncorrectState'])
def ensure_cgw_absent(self, gw_id):
response = self.ec2.delete_customer_gateway(
DryRun=False,

@ -214,6 +214,8 @@ def create_vgw(client, module):
except botocore.exceptions.WaiterError as e:
module.fail_json(msg="Failed to wait for Vpn Gateway {0} to be available".format(response['VpnGateway']['VpnGatewayId']),
exception=traceback.format_exc())
except client.exceptions.from_code('VpnGatewayLimitExceeded') as e:
module.fail_json(msg="Too many VPN gateways exist in this account.", exception=traceback.format_exc())
except botocore.exceptions.ClientError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())

Loading…
Cancel
Save