From 668092e95ac1f0be79d531753b8856d790c4cfca Mon Sep 17 00:00:00 2001 From: kwerey Date: Tue, 16 May 2017 16:10:15 +0100 Subject: [PATCH] [cloud] Add support for AWS China to elasticache_subnet_group role (#24286) --- .../modules/cloud/amazon/elasticache_subnet_group.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py index c7d30fbdeb..18e89d9fa0 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py +++ b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py @@ -71,8 +71,7 @@ EXAMPLES = ''' try: import boto - from boto.elasticache.layer1 import ElastiCacheConnection - from boto.regioninfo import RegionInfo + from boto.elasticache import connect_to_region from boto.exception import BotoServerError HAS_BOTO = True except ImportError: @@ -115,9 +114,7 @@ def main(): """Get an elasticache connection""" try: - endpoint = "elasticache.%s.amazonaws.com" % region - connect_region = RegionInfo(name=region, endpoint=endpoint) - conn = ElastiCacheConnection(region=connect_region, **aws_connect_kwargs) + conn = connect_to_region(region_name=region, **aws_connect_kwargs) except boto.exception.NoAuthHandlerFound as e: module.fail_json(msg=e.message)