Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk import cleanup #360

Merged
merged 5 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion plugins/modules/aws_config_aggregation_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

try:
import botocore
from botocore.exceptions import BotoCoreError, ClientError
except ImportError:
pass # handled by AnsibleAWSModule

Expand Down
8 changes: 5 additions & 3 deletions plugins/modules/aws_config_delivery_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@

try:
import botocore
from botocore.exceptions import BotoCoreError, ClientError
except ImportError:
pass # handled by AnsibleAWSModule

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

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry


# this waits for an IAM role to become fully available, at the cost of
Expand Down
8 changes: 5 additions & 3 deletions plugins/modules/aws_config_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@

try:
import botocore
from botocore.exceptions import BotoCoreError, ClientError
except ImportError:
pass # handled by AnsibleAWSModule

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

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry


def resource_exists(client, module, params):
Expand Down
8 changes: 5 additions & 3 deletions plugins/modules/aws_config_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@

try:
import botocore
from botocore.exceptions import BotoCoreError, ClientError
except ImportError:
pass # handled by AnsibleAWSModule

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

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry


def rule_exists(client, module, params):
Expand Down
19 changes: 9 additions & 10 deletions plugins/modules/cloudformation_stack_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,26 +296,25 @@

''' # NOQA

import time
import datetime
import uuid
import itertools
import time
import uuid

try:
import boto3
import botocore.exceptions
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
# handled by AnsibleAWSModule
pass

from ansible_collections.amazon.aws.plugins.module_utils.ec2 import (AWSRetry,
boto3_tag_list_to_ansible_dict,
ansible_dict_to_boto3_tag_list,
camel_dict_to_snake_dict,
)
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule, is_boto3_error_code
from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_tag_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict


def create_stack_set(module, stack_params, cfn):
Expand Down
13 changes: 5 additions & 8 deletions plugins/modules/cloudfront_origin_access_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,18 @@

'''

from ansible_collections.amazon.aws.plugins.module_utils.cloudfront_facts import CloudFrontFactsServiceManager
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
import datetime
from functools import partial
import json
import traceback

try:
import botocore
from botocore.signers import CloudFrontSigner
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by imported AnsibleAWSModule

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.cloudfront_facts import CloudFrontFactsServiceManager
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule


class CloudFrontOriginAccessIdentityServiceManager(object):
"""
Expand Down
9 changes: 3 additions & 6 deletions plugins/modules/cloudwatchlogs_log_group_metric_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,10 @@
]

"""
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule, is_boto3_error_code, get_boto3_client_method_parameters
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict

try:
from botocore.exceptions import ClientError, BotoCoreError, WaiterError
except ImportError:
pass # caught by AnsibleAWSModule
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule


def metricTransformationHandler(metricTransformations, originMetricTransformations=None):
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/dynamodb_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
- { "AttributeName": "deploy_timestamp", "Enabled": true }
'''

import traceback

try:
import botocore
except ImportError:
Expand Down
13 changes: 7 additions & 6 deletions plugins/modules/ec2_ami_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,17 @@
sample: ami-e689729e
'''

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.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_tag_list
from ansible.module_utils._text import to_native

try:
from botocore.exceptions import ClientError, NoCredentialsError, WaiterError, BotoCoreError
from botocore.exceptions import ClientError, WaiterError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_tag_list


def copy_image(module, ec2):
"""
Expand Down
5 changes: 2 additions & 3 deletions plugins/modules/ec2_customer_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,14 @@
'''

try:
from botocore.exceptions import ClientError
import boto3
import botocore
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict


class Ec2CustomerGatewayManager:
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_elb.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
import boto.ec2
import boto.ec2.autoscale
import boto.ec2.elb
from boto.regioninfo import RegionInfo
except ImportError:
pass # Handled by HAS_BOTO

Expand Down
16 changes: 7 additions & 9 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,32 +795,30 @@
sample: vpc-0011223344
'''

from collections import namedtuple
import re
import uuid
import string
import textwrap
import time
from collections import namedtuple
import uuid

try:
import boto3
import botocore.exceptions
except ImportError:
pass # caught by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves.urllib import parse as urlparse
from ansible.module_utils._text import to_bytes
from ansible.module_utils._text import to_native

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
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 compare_aws_tags
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_tag_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import snake_dict_to_camel_dict
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 compare_aws_tags

module = None

Expand Down
6 changes: 2 additions & 4 deletions plugins/modules/ec2_instance_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,21 +507,19 @@
sample: vpc-0011223344
'''

import traceback
import datetime


try:
import boto3
import botocore
from botocore.exceptions import ClientError
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
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


def list_ec2_instances(connection, module):
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/ec2_lc_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@
'''

try:
import boto3
import botocore
from botocore.exceptions import ClientError
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

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_launch_configs(connection, module):
Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/ec2_snapshot_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,14 @@
import traceback

try:
import boto3
import botocore
from botocore.exceptions import ClientError, WaiterError
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

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 copy_snapshot(module, ec2):
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/ec2_vpc_endpoint_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
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 camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_filter_list


def date_handler(obj):
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_vpc_vgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@

try:
import botocore
import boto3
except ImportError:
pass # Handled by AnsibleAWSModule

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ecs_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
'''

try:
import boto3
import botocore
from botocore.exceptions import ClientError, EndpointConnectionError
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ecs_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
type: str
sample: ACTIVE
'''

import time

try:
import boto3
import botocore
except ImportError:
pass # Handled by AnsibleAWSModule
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/ecs_taskdefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@
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.module_utils._text import to_text

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule


class EcsTaskManager:
"""Handles ECS Tasks"""
Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/elasticache_parameter_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,15 @@
import traceback

try:
import boto3
import botocore
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_text
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.six import string_types

# import module snippets
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 create(module, conn, name, group_family, description):
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/elb_application_lb_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,17 @@
import traceback

try:
import boto3
import botocore
from botocore.exceptions import ClientError, NoCredentialsError
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
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


def get_elb_listeners(connection, module, elb_arn):
Expand Down
Loading