Fix get_s3_connection (fixes #22317)

Override aws_connect_kwargs rather than prepending to them. Should fix an issue in which `calling_format` is set twice in the kwargs passed to `boto.connect_s3` or `S3Connection` if a bucket name contains a `.`
pull/22318/head
Joshua C. Randall 8 years ago committed by GitHub
parent aa3fbb0d54
commit 7f61b8bebd

@ -713,22 +713,18 @@ def main():
def get_s3_connection(aws_connect_kwargs, location, rgw, s3_url): def get_s3_connection(aws_connect_kwargs, location, rgw, s3_url):
if s3_url and rgw: if s3_url and rgw:
rgw = urlparse(s3_url) rgw = urlparse(s3_url)
s3 = boto.connect_s3( aws_connect_kwargs['is_secure'] = rgw.scheme == 'https'
is_secure=rgw.scheme == 'https', aws_connect_kwargs['host'] = rgw.hostname
host=rgw.hostname, aws_connect_kwargs['port'] = rgw.port
port=rgw.port, aws_connect_kwargs['calling_format'] = OrdinaryCallingFormat()
calling_format=OrdinaryCallingFormat(), s3 = boto.connect_s3(**aws_connect_kwargs)
**aws_connect_kwargs
)
elif is_fakes3(s3_url): elif is_fakes3(s3_url):
fakes3 = urlparse(s3_url) fakes3 = urlparse(s3_url)
s3 = S3Connection( aws_connect_kwargs['is_secure'] = fakes3.scheme == 'fakes3s'
is_secure=fakes3.scheme == 'fakes3s', aws_connect_kwargs['host'] = fakes3.hostname
host=fakes3.hostname, aws_connect_kwargs['port'] = fakes3.port
port=fakes3.port, aws_connect_kwargs['calling_format'] = OrdinaryCallingFormat()
calling_format=OrdinaryCallingFormat(), s3 = S3Connection(**aws_connect_kwargs)
**aws_connect_kwargs
)
elif is_walrus(s3_url): elif is_walrus(s3_url):
walrus = urlparse(s3_url).hostname walrus = urlparse(s3_url).hostname
s3 = boto.connect_walrus(walrus, **aws_connect_kwargs) s3 = boto.connect_walrus(walrus, **aws_connect_kwargs)

Loading…
Cancel
Save