mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-04 15:40:20 -07:00
Add better handling for errors causing integration test instability (#40184)
* Add better handling for errors causing integration test instability
This commit is contained in:
parent
0dc73e7822
commit
ede47910f8
2 changed files with 4 additions and 1 deletions
|
@ -131,7 +131,7 @@ except ImportError:
|
||||||
HAS_BOTO3 = False
|
HAS_BOTO3 = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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)
|
ec2_argument_spec, get_aws_connection_info)
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@ class Ec2CustomerGatewayManager:
|
||||||
except ClientError as e:
|
except ClientError as e:
|
||||||
module.fail_json(msg=e.message)
|
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):
|
def ensure_cgw_absent(self, gw_id):
|
||||||
response = self.ec2.delete_customer_gateway(
|
response = self.ec2.delete_customer_gateway(
|
||||||
DryRun=False,
|
DryRun=False,
|
||||||
|
|
|
@ -214,6 +214,8 @@ def create_vgw(client, module):
|
||||||
except botocore.exceptions.WaiterError as e:
|
except botocore.exceptions.WaiterError as e:
|
||||||
module.fail_json(msg="Failed to wait for Vpn Gateway {0} to be available".format(response['VpnGateway']['VpnGatewayId']),
|
module.fail_json(msg="Failed to wait for Vpn Gateway {0} to be available".format(response['VpnGateway']['VpnGatewayId']),
|
||||||
exception=traceback.format_exc())
|
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:
|
except botocore.exceptions.ClientError as e:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue