mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
update to use connect_to_region to avoid errors with china
This commit is contained in:
parent
abdb1afa0a
commit
945909bf67
1 changed files with 3 additions and 11 deletions
|
@ -130,13 +130,6 @@ except ImportError:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
class Region:
|
|
||||||
def __init__(self, region):
|
|
||||||
'''connects boto to the region specified in the cloudformation template'''
|
|
||||||
self.name = region
|
|
||||||
self.endpoint = 'cloudformation.%s.amazonaws.com' % region
|
|
||||||
|
|
||||||
|
|
||||||
def boto_exception(err):
|
def boto_exception(err):
|
||||||
'''generic error message handler'''
|
'''generic error message handler'''
|
||||||
if hasattr(err, 'error_message'):
|
if hasattr(err, 'error_message'):
|
||||||
|
@ -239,11 +232,10 @@ def main():
|
||||||
stack_outputs = {}
|
stack_outputs = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cf_region = Region(region)
|
cfn = boto.cloudformation.connect_to_region(
|
||||||
cfn = boto.cloudformation.connection.CloudFormationConnection(
|
region,
|
||||||
aws_access_key_id=aws_access_key,
|
aws_access_key_id=aws_access_key,
|
||||||
aws_secret_access_key=aws_secret_key,
|
aws_secret_access_key=aws_secret_key,
|
||||||
region=cf_region,
|
|
||||||
)
|
)
|
||||||
except boto.exception.NoAuthHandlerFound, e:
|
except boto.exception.NoAuthHandlerFound, e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
Loading…
Reference in a new issue