diff --git a/plugins/modules/ec2_vpc_peering_info.py b/plugins/modules/ec2_vpc_peering_info.py index 048747abcd8..f43d1378aa8 100644 --- a/plugins/modules/ec2_vpc_peering_info.py +++ b/plugins/modules/ec2_vpc_peering_info.py @@ -208,8 +208,8 @@ from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.core import normalize_boto3_result from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict 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 from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict diff --git a/plugins/modules/wafv2_ip_set_info.py b/plugins/modules/wafv2_ip_set_info.py index 3a9d1f331a8..0c2bf3f0e4e 100644 --- a/plugins/modules/wafv2_ip_set_info.py +++ b/plugins/modules/wafv2_ip_set_info.py @@ -70,14 +70,14 @@ type: str """ -from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict - try: from botocore.exceptions import ClientError, BotoCoreError except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict + def list_ip_sets(wafv2, scope, fail_json_aws, Nextmarker=None): # there is currently no paginator for wafv2 diff --git a/plugins/modules/wafv2_resources.py b/plugins/modules/wafv2_resources.py index 11349bbd2f3..bbed06a0499 100644 --- a/plugins/modules/wafv2_resources.py +++ b/plugins/modules/wafv2_resources.py @@ -60,15 +60,15 @@ type: list """ -from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict -from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls - try: from botocore.exceptions import ClientError, BotoCoreError except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict +from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls + def get_web_acl(wafv2, name, scope, id, fail_json_aws): try: diff --git a/plugins/modules/wafv2_resources_info.py b/plugins/modules/wafv2_resources_info.py index 913474fbeec..6ab7aa04ca1 100644 --- a/plugins/modules/wafv2_resources_info.py +++ b/plugins/modules/wafv2_resources_info.py @@ -49,15 +49,15 @@ type: list """ -from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict -from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls - try: from botocore.exceptions import ClientError, BotoCoreError except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict +from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls + def get_web_acl(wafv2, name, scope, id, fail_json_aws): try: diff --git a/plugins/modules/wafv2_rule_group_info.py b/plugins/modules/wafv2_rule_group_info.py index e43957018a1..47d1e68cc55 100644 --- a/plugins/modules/wafv2_rule_group_info.py +++ b/plugins/modules/wafv2_rule_group_info.py @@ -94,15 +94,15 @@ sampled_requests_enabled: False """ -from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict -from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_rule_groups - try: from botocore.exceptions import ClientError, BotoCoreError except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict +from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_rule_groups + def get_rule_group(wafv2, name, scope, id, fail_json_aws): try: diff --git a/plugins/modules/wafv2_web_acl_info.py b/plugins/modules/wafv2_web_acl_info.py index 15674cd0aa6..54545c10acc 100644 --- a/plugins/modules/wafv2_web_acl_info.py +++ b/plugins/modules/wafv2_web_acl_info.py @@ -89,15 +89,15 @@ sampled_requests_enabled: false """ -from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict -from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls - try: from botocore.exceptions import ClientError, BotoCoreError except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict +from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls + def get_web_acl(wafv2, name, scope, id, fail_json_aws): try: diff --git a/scripts/inventory/ec2.py b/scripts/inventory/ec2.py index 6a90fcdd072..d903de14ac8 100644 --- a/scripts/inventory/ec2.py +++ b/scripts/inventory/ec2.py @@ -140,24 +140,23 @@ 'webserver-ansible-blue-172.31.0.1' ''' -import sys -import os import argparse +import json +import os import re -from time import time +import sys +from collections import defaultdict from copy import deepcopy from datetime import date, datetime +from time import time + import boto from boto import ec2 -from boto import rds from boto import elasticache +from boto import rds from boto import route53 from boto import sts -from ansible.module_utils import six -from ansible_collections.amazon.aws.plugins.module_utils import ec2 as ec2_utils -from ansible.module_utils.six.moves import configparser - HAS_BOTO3 = False try: # Used so that we can cleanly fail, some of our (optional) dependencies need this @@ -166,9 +165,10 @@ except ImportError: pass -from collections import defaultdict +from ansible.module_utils import six +from ansible.module_utils.six.moves import configparser +from ansible_collections.amazon.aws.plugins.module_utils import ec2 as ec2_utils -import json DEFAULTS = { 'all_elasticache_clusters': 'False', diff --git a/tests/unit/plugins/modules/test_aws_acm.py b/tests/unit/plugins/modules/test_aws_acm.py index e8e691085ae..5b0f86abf15 100644 --- a/tests/unit/plugins/modules/test_aws_acm.py +++ b/tests/unit/plugins/modules/test_aws_acm.py @@ -17,12 +17,12 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ansible.module_utils._text import to_text from pprint import pprint from ansible_collections.community.aws.plugins.modules.aws_acm import chain_compare from ansible_collections.community.aws.plugins.modules.aws_acm import pem_chain_split +from ansible.module_utils._text import to_text def test_chain_compare(): diff --git a/tests/unit/plugins/modules/test_aws_direct_connect_confirm_connection.py b/tests/unit/plugins/modules/test_aws_direct_connect_confirm_connection.py index 834975f6b28..17bd5c7e45d 100644 --- a/tests/unit/plugins/modules/test_aws_direct_connect_confirm_connection.py +++ b/tests/unit/plugins/modules/test_aws_direct_connect_confirm_connection.py @@ -9,8 +9,8 @@ pass from ansible_collections.amazon.aws.plugins.module_utils.ec2 import HAS_BOTO3 -from ansible_collections.community.aws.tests.unit.compat.mock import patch from ansible_collections.community.aws.tests.unit.compat.mock import call +from ansible_collections.community.aws.tests.unit.compat.mock import patch from ansible_collections.community.aws.tests.unit.plugins.modules.utils import AnsibleExitJson from ansible_collections.community.aws.tests.unit.plugins.modules.utils import AnsibleFailJson from ansible_collections.community.aws.tests.unit.plugins.modules.utils import ModuleTestCase diff --git a/tests/unit/plugins/modules/test_data_pipeline.py b/tests/unit/plugins/modules/test_data_pipeline.py index 3e27f9407a6..b7971aac602 100644 --- a/tests/unit/plugins/modules/test_data_pipeline.py +++ b/tests/unit/plugins/modules/test_data_pipeline.py @@ -7,17 +7,18 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +import collections import os import json -import collections - import pytest + +from ansible.module_utils._text import to_text + # Magic... Incorrectly identified by pylint as unused from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import maybe_sleep # pylint: disable=unused-import from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import placeboify # pylint: disable=unused-import from ansible_collections.community.aws.plugins.modules import data_pipeline -from ansible.module_utils._text import to_text # test_api_gateway.py requires the `boto3` and `botocore` modules boto3 = pytest.importorskip('boto3') diff --git a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py b/tests/unit/plugins/modules/test_ec2_vpc_vpn.py index 9ee706286b3..49ef596a5b1 100644 --- a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py +++ b/tests/unit/plugins/modules/test_ec2_vpc_vpn.py @@ -4,8 +4,8 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import pytest import os +import pytest # Magic... Incorrectly identified by pylint as unused from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import placeboify # pylint: disable=unused-import diff --git a/tests/unit/plugins/modules/test_lambda.py b/tests/unit/plugins/modules/test_lambda.py index 25d3b7044d7..348a00f5a8f 100644 --- a/tests/unit/plugins/modules/test_lambda.py +++ b/tests/unit/plugins/modules/test_lambda.py @@ -17,6 +17,7 @@ from ansible_collections.community.aws.tests.unit.plugins.modules.utils import ModuleTestCase from ansible_collections.community.aws.tests.unit.plugins.modules.utils import set_module_args + if not HAS_BOTO3: pytestmark = pytest.mark.skip("lambda.py requires the `boto3` and `botocore` modules")