Skip to content

Commit

Permalink
Sanity test fixups (#51)
Browse files Browse the repository at this point in the history
* Missing import

* Tell the linter to ignore duplicat exceptions when using is_boto3_error_code

* fix missing_variable (bad C&P)

ci_complete
  • Loading branch information
tremble authored May 13, 2020
1 parent 7a20cd1 commit ed25a62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion plugins/modules/ec2_snapshot_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.aws.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.aws.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict

Expand All @@ -203,7 +204,7 @@ def list_ec2_snapshots(connection, module):
if len(snapshot_ids) > 1:
module.warn("Some of your snapshots may exist, but %s" % str(e))
snapshots = {'Snapshots': []}
except ClientError as e:
except ClientError as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, msg='Failed to describe snapshots')

# Turn the boto3 result in to ansible_friendly_snaked_names
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ec2_vol.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def delete_volume(module, ec2):
except boto.exception.EC2ResponseError as ec2_error:
if ec2_error.code == 'InvalidVolume.NotFound':
module.exit_json(changed=False)
module.fail_json_aws(e)
module.fail_json_aws(ec2_error)


def boto_supports_volume_encryption():
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/ec2_vpc_net_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ def describe_vpcs(connection, module):
cl_enabled = connection.describe_vpc_classic_link(VpcIds=vpc_list)
except is_boto3_error_code('UnsupportedOperation'):
cl_enabled = {'Vpcs': [{'VpcId': vpc_id, 'ClassicLinkEnabled': False} for vpc_id in vpc_list]}
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, msg='Unable to describe if ClassicLink is enabled')

try:
cl_dns_support = connection.describe_vpc_classic_link_dns_support(VpcIds=vpc_list)
except is_boto3_error_code('UnsupportedOperation'):
cl_dns_support = {'Vpcs': [{'VpcId': vpc_id, 'ClassicLinkDnsSupported': False} for vpc_id in vpc_list]}
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, msg='Unable to describe if ClassicLinkDns is supported')

# Loop through the results and add the other VPC attributes we gathered
Expand Down

0 comments on commit ed25a62

Please sign in to comment.