diff --git a/lib/ansible/modules/cloud/amazon/s3.py b/lib/ansible/modules/cloud/amazon/s3.py index 467cdb1d38..dc3703abdb 100644 --- a/lib/ansible/modules/cloud/amazon/s3.py +++ b/lib/ansible/modules/cloud/amazon/s3.py @@ -714,6 +714,13 @@ def main(): def get_s3_connection(aws_connect_kwargs, location, rgw, s3_url): if s3_url and rgw: rgw = urlparse(s3_url) + # ensure none of the named arguments we will pass to boto.connect_s3 + # are already present in aws_connect_kwargs + for kw in ['is_secure', 'host', 'port', 'calling_format']: + try: + del aws_connect_kwargs[kw] + except KeyError: + pass s3 = boto.connect_s3( is_secure=rgw.scheme == 'https', host=rgw.hostname, @@ -723,6 +730,13 @@ def get_s3_connection(aws_connect_kwargs, location, rgw, s3_url): ) elif is_fakes3(s3_url): fakes3 = urlparse(s3_url) + # ensure none of the named arguments we will pass to S3Connection + # are already present in aws_connect_kwargs + for kw in ['is_secure', 'host', 'port', 'calling_format']: + try: + del aws_connect_kwargs[kw] + except KeyError: + pass s3 = S3Connection( is_secure=fakes3.scheme == 'fakes3s', host=fakes3.hostname,