From 7cd7bad2e83363a8c87e3ff5b937e700c7d19459 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 26 Mar 2015 11:23:32 -0400 Subject: [PATCH] added patch to workaround some s3 connection faliures --- lib/ansible/modules/cloud/amazon/s3.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/s3.py b/lib/ansible/modules/cloud/amazon/s3.py index 306e4f0d224..ad8ed0d028c 100644 --- a/lib/ansible/modules/cloud/amazon/s3.py +++ b/lib/ansible/modules/cloud/amazon/s3.py @@ -335,6 +335,10 @@ def main(): s3 = boto.connect_walrus(walrus, aws_access_key, aws_secret_key) else: s3 = boto.s3.connect_to_region(location, aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_key, is_secure=True, calling_format=OrdinaryCallingFormat()) + # use this as fallback because connect_to_region seems to fail in boto + non 'classic' aws accounts in some cases + if s3 is None: + s3 = boto.connect_s3(aws_access_key, aws_secret_key) + except boto.exception.NoAuthHandlerFound, e: module.fail_json(msg='No Authentication Handler found: %s ' % str(e)) except Exception, e: