Skip to content

Commit

Permalink
Bulk import cleanup (ansible-collections#360)
Browse files Browse the repository at this point in the history
* Split imports and reorder
* Import camel_dict_to_snake_dict and snake_dict_to_camel_dict direct from ansible.module_utils.common.dict_transformations
* Remove unused imports
* Route53 Info was migrated to Boto3 drop the HAS_BOTO check and import
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@130cf3c
  • Loading branch information
tremble authored and goneri committed Sep 21, 2022
1 parent bc7b1e3 commit 4f78081
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
5 changes: 1 addition & 4 deletions plugins/modules/route53_health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,15 @@
import uuid

try:
import boto
import boto.ec2
from boto import route53
from boto.route53 import Route53Connection, exception
from boto.route53.healthcheck import HealthCheck
except ImportError:
pass # Handled by HAS_BOTO

# import module snippets
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import get_aws_connection_info
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import HAS_BOTO
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import get_aws_connection_info


# Things that can't get changed:
Expand Down
11 changes: 2 additions & 9 deletions plugins/modules/route53_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,15 @@
start_record_name: "host1.workshop.test.io"
register: RECORDS
'''

try:
import boto
import botocore
import boto3
except ImportError:
pass # Handled by HAS_BOTO and HAS_BOTO3
pass # Handled by AnsibleAWSModule

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 HAS_BOTO
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import HAS_BOTO3


def get_hosted_zone(client, module):
Expand Down Expand Up @@ -461,10 +458,6 @@ def main():
if module._name == 'route53_facts':
module.deprecate("The 'route53_facts' module has been renamed to 'route53_info'", date='2021-12-01', collection_name='community.aws')

# Validate Requirements
if not (HAS_BOTO or HAS_BOTO3):
module.fail_json(msg='json and boto/boto3 is required.')

try:
route53 = module.client('route53')
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
Expand Down

0 comments on commit 4f78081

Please sign in to comment.