[cloud] s3_bucket: fix connections for buckets with dots in names (#24720)

Refer to 689f135 for similar fix in s3 module. This change makes `OrdinaryCallingFormat` default for handling S3 connections. 

Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
pull/22377/head
Yury V. Zaytsev 8 years ago committed by Ryan Brown
parent bc24ae88a8
commit c559567f16

@ -393,6 +393,11 @@ def main():
flavour = 'aws' flavour = 'aws'
# bucket names with .'s in them need to use the calling_format option,
# otherwise the connection will fail. See https://github.com/boto/boto/issues/2836
# for more details.
aws_connect_params['calling_format'] = OrdinaryCallingFormat()
# Look at s3_url and tweak connection settings # Look at s3_url and tweak connection settings
# if connecting to Walrus or fakes3 # if connecting to Walrus or fakes3
try: try:
@ -402,7 +407,6 @@ def main():
host=ceph.hostname, host=ceph.hostname,
port=ceph.port, port=ceph.port,
is_secure=ceph.scheme == 'https', is_secure=ceph.scheme == 'https',
calling_format=OrdinaryCallingFormat(),
**aws_connect_params **aws_connect_params
) )
flavour = 'ceph' flavour = 'ceph'
@ -412,14 +416,14 @@ def main():
is_secure=fakes3.scheme == 'fakes3s', is_secure=fakes3.scheme == 'fakes3s',
host=fakes3.hostname, host=fakes3.hostname,
port=fakes3.port, port=fakes3.port,
calling_format=OrdinaryCallingFormat(),
**aws_connect_params **aws_connect_params
) )
elif is_walrus(s3_url): elif is_walrus(s3_url):
del aws_connect_params['calling_format']
walrus = urlparse.urlparse(s3_url).hostname walrus = urlparse.urlparse(s3_url).hostname
connection = boto.connect_walrus(walrus, **aws_connect_params) connection = boto.connect_walrus(walrus, **aws_connect_params)
else: else:
connection = boto.s3.connect_to_region(location, is_secure=True, calling_format=OrdinaryCallingFormat(), **aws_connect_params) connection = boto.s3.connect_to_region(location, is_secure=True, **aws_connect_params)
# use this as fallback because connect_to_region seems to fail in boto + non 'classic' aws accounts in some cases # use this as fallback because connect_to_region seems to fail in boto + non 'classic' aws accounts in some cases
if connection is None: if connection is None:
connection = boto.connect_s3(**aws_connect_params) connection = boto.connect_s3(**aws_connect_params)

Loading…
Cancel
Save