mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[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>
This commit is contained in:
parent
bc24ae88a8
commit
c559567f16
1 changed files with 7 additions and 3 deletions
|
@ -393,6 +393,11 @@ def main():
|
|||
|
||||
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
|
||||
# if connecting to Walrus or fakes3
|
||||
try:
|
||||
|
@ -402,7 +407,6 @@ def main():
|
|||
host=ceph.hostname,
|
||||
port=ceph.port,
|
||||
is_secure=ceph.scheme == 'https',
|
||||
calling_format=OrdinaryCallingFormat(),
|
||||
**aws_connect_params
|
||||
)
|
||||
flavour = 'ceph'
|
||||
|
@ -412,14 +416,14 @@ def main():
|
|||
is_secure=fakes3.scheme == 'fakes3s',
|
||||
host=fakes3.hostname,
|
||||
port=fakes3.port,
|
||||
calling_format=OrdinaryCallingFormat(),
|
||||
**aws_connect_params
|
||||
)
|
||||
elif is_walrus(s3_url):
|
||||
del aws_connect_params['calling_format']
|
||||
walrus = urlparse.urlparse(s3_url).hostname
|
||||
connection = boto.connect_walrus(walrus, **aws_connect_params)
|
||||
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
|
||||
if connection is None:
|
||||
connection = boto.connect_s3(**aws_connect_params)
|
||||
|
|
Loading…
Reference in a new issue