From 7917e3c98827cc1ebd7697bd4b44bbe15f650caf Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Fri, 2 Feb 2018 15:38:47 -0500 Subject: [PATCH] Fix syntax error so route table tests always try to clean up (#35663) * Always try to clean up after route table tests * Wait for a new VPC a chance to become available before attempting to get its current state --- lib/ansible/modules/cloud/amazon/ec2_vpc_net.py | 5 +++++ test/integration/targets/ec2_vpc_route_table/tasks/main.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py index f52a7814599..e2fedbefdb0 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py @@ -356,6 +356,11 @@ def main(): except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, "Failed to update enabled dns hostnames attribute") + try: + connection.get_waiter('vpc_available').wait(VpcIds=[vpc_id]) + except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: + module.fail_json_aws(e, msg="Unable to wait for VPC {0} to be available.".format(vpc_id)) + final_state = camel_dict_to_snake_dict(get_vpc(module, connection, vpc_id)) final_state['tags'] = boto3_tag_list_to_ansible_dict(final_state.get('tags', [])) final_state['id'] = final_state.pop('vpc_id') diff --git a/test/integration/targets/ec2_vpc_route_table/tasks/main.yml b/test/integration/targets/ec2_vpc_route_table/tasks/main.yml index ca663424a35..045976e43cd 100644 --- a/test/integration/targets/ec2_vpc_route_table/tasks/main.yml +++ b/test/integration/targets/ec2_vpc_route_table/tasks/main.yml @@ -545,7 +545,7 @@ - recreate_private_table.changed - recreate_private_table.route_table.id != create_public_table.route_table.id -- always: + always: ############################################################################# # TEAR DOWN STARTS HERE #############################################################################