diff options
Diffstat (limited to 'lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py')
-rw-r--r-- | lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py index 700b692d88..53c954acc4 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py @@ -147,6 +147,7 @@ def get_vgw_info(vgws): return vgw_info + def wait_for_status(client, module, vpn_gateway_id, status): polling_increment_secs = 15 max_retries = (module.params.get('wait_timeout') // polling_increment_secs) @@ -227,7 +228,7 @@ def delete_vgw(client, module, vpn_gateway_id): except botocore.exceptions.ClientError as e: module.fail_json(msg=to_native(e), exception=traceback.format_exc()) - #return the deleted VpnGatewayId as this is not included in the above response + # return the deleted VpnGatewayId as this is not included in the above response result = vpn_gateway_id return result @@ -236,7 +237,7 @@ def create_tags(client, module, vpn_gateway_id): params = dict() try: - response = client.create_tags(Resources=[vpn_gateway_id],Tags=load_tags(module)) + response = client.create_tags(Resources=[vpn_gateway_id], Tags=load_tags(module)) except botocore.exceptions.ClientError as e: module.fail_json(msg=to_native(e), exception=traceback.format_exc()) @@ -280,7 +281,7 @@ def find_tags(client, module, resource_id=None): try: response = client.describe_tags(Filters=[ {'Name': 'resource-id', 'Values': [resource_id]} - ]) + ]) except botocore.exceptions.ClientError as e: module.fail_json(msg=to_native(e), exception=traceback.format_exc()) @@ -295,7 +296,7 @@ def check_tags(client, module, existing_vgw, vpn_gateway_id): changed = False tags_list = {} - #format tags for comparison + # format tags for comparison for tags in existing_vgw[0]['Tags']: if tags['Key'] != 'Name': tags_list[tags['Key']] = tags['Value'] @@ -307,7 +308,7 @@ def check_tags(client, module, existing_vgw, vpn_gateway_id): vgw = find_vgw(client, module) changed = True - #if no tag args are supplied, delete any existing tags with the exception of the name tag + # if no tag args are supplied, delete any existing tags with the exception of the name tag if params['Tags'] is None and tags_list != {}: tags_to_delete = [] for tags in existing_vgw[0]['Tags']: @@ -346,7 +347,7 @@ def find_vgw(client, module, vpn_gateway_id=None): response = client.describe_vpn_gateways(Filters=[ {'Name': 'type', 'Values': [params['Type']]}, {'Name': 'tag:Name', 'Values': [params['Name']]} - ]) + ]) except botocore.exceptions.ClientError as e: module.fail_json(msg=to_native(e), exception=traceback.format_exc()) @@ -362,7 +363,7 @@ def find_vgw(client, module, vpn_gateway_id=None): response = client.describe_vpn_gateways(Filters=[ {'Name': 'type', 'Values': [params['Type']]}, {'Name': 'tag:Name', 'Values': [params['Name']]} - ]) + ]) except botocore.exceptions.ClientError as e: module.fail_json(msg=to_native(e), exception=traceback.format_exc()) @@ -502,7 +503,7 @@ def ensure_vgw_absent(client, module): deleted_vgw = "Nothing to do" else: - #Check that a name and type argument has been supplied if no vgw-id + # Check that a name and type argument has been supplied if no vgw-id if not module.params.get('name') or not module.params.get('type'): module.fail_json(msg='A name and type is required when no vgw-id and a status of \'absent\' is suppled') @@ -518,7 +519,7 @@ def ensure_vgw_absent(client, module): # detach the vpc from the vgw detach_vgw(client, module, vpn_gateway_id, params['VpcId']) - #now that the vpc has been detached, delete the vgw + # now that the vpc has been detached, delete the vgw deleted_vgw = delete_vgw(client, module, vpn_gateway_id) changed = True @@ -528,7 +529,7 @@ def ensure_vgw_absent(client, module): detach_vgw(client, module, vpn_gateway_id, vpc_to_detach) changed = True - #now that the vpc has been detached, delete the vgw + # now that the vpc has been detached, delete the vgw deleted_vgw = delete_vgw(client, module, vpn_gateway_id) else: @@ -555,7 +556,7 @@ def main(): wait_timeout=dict(type='int', default=320), type=dict(default='ipsec.1', choices=['ipsec.1']), tags=dict(default=None, required=False, type='dict', aliases=['resource_tags']), - ) + ) ) module = AnsibleModule(argument_spec=argument_spec) |