Skip to content

Commit

Permalink
use module.region to get aws region instead of get_aws_connection_info
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Apr 22, 2020
1 parent 63dac48 commit 0362847
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions plugins/modules/aws_ses_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@
'''

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

import time

Expand Down Expand Up @@ -534,7 +535,7 @@ def main():
state = module.params.get("state")

if state == 'present':
region = get_aws_connection_info(module, boto3=True)[0]
region = module.region
account_id = get_account_id(module)
validate_params_for_identity_present(module)
create_or_update_identity(connection, module, region, account_id)
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/efs_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.aws.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import get_aws_connection_info, AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict
from ansible.module_utils._text import to_native
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 camel_dict_to_snake_dict


class EFSConnection(object):
Expand All @@ -200,7 +200,7 @@ def __init__(self, module):
except Exception as e:
module.fail_json(msg="Failed to connect to AWS: %s" % to_native(e))

self.region = get_aws_connection_info(module, boto3=True)[0]
self.region = module.region

@AWSRetry.exponential_backoff(catch_extra_error_codes=['ThrottlingException'])
def list_file_systems(self, **kwargs):
Expand Down
10 changes: 4 additions & 6 deletions plugins/modules/elasticache_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,9 @@
'''

from ansible_collections.amazon.aws.plugins.module_utils.aws.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import (get_aws_connection_info,
camel_dict_to_snake_dict,
AWSRetry,
boto3_tag_list_to_ansible_dict,
)
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 camel_dict_to_snake_dict


try:
Expand Down Expand Up @@ -275,7 +273,7 @@ def get_aws_account_id(module):


def get_elasticache_clusters(client, module):
region = get_aws_connection_info(module, boto3=True)[0]
region = module.region
try:
clusters = describe_cache_clusters_with_backoff(client, cluster_id=module.params.get('name'))
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
Expand Down

0 comments on commit 0362847

Please sign in to comment.