mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
AWS S3: fix method call for fakes3 S3 backend (#33085)
* AWS S3: fix method call for fakes3 S3 backend Fixes #33083 Signed-off-by: Marc-Aurèle Brothier <m@brothier.org> * Auto append port based on proto Signed-off-by: Marc-Aurèle Brothier <m@brothier.org>
This commit is contained in:
parent
07bb7684b0
commit
bd5dc01d65
1 changed files with 8 additions and 4 deletions
|
@ -555,15 +555,19 @@ def get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url):
|
||||||
rgw = urlparse(s3_url)
|
rgw = urlparse(s3_url)
|
||||||
params = dict(module=module, conn_type='client', resource='s3', use_ssl=rgw.scheme == 'https', region=location, endpoint=s3_url, **aws_connect_kwargs)
|
params = dict(module=module, conn_type='client', resource='s3', use_ssl=rgw.scheme == 'https', region=location, endpoint=s3_url, **aws_connect_kwargs)
|
||||||
elif is_fakes3(s3_url):
|
elif is_fakes3(s3_url):
|
||||||
for kw in ['is_secure', 'host', 'port'] and list(aws_connect_kwargs.keys()):
|
|
||||||
del aws_connect_kwargs[kw]
|
|
||||||
fakes3 = urlparse(s3_url)
|
fakes3 = urlparse(s3_url)
|
||||||
|
port = fakes3.port
|
||||||
if fakes3.scheme == 'fakes3s':
|
if fakes3.scheme == 'fakes3s':
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
|
if port is None:
|
||||||
|
port = 443
|
||||||
else:
|
else:
|
||||||
protocol = "http"
|
protocol = "http"
|
||||||
params = dict(service_name='s3', endpoint_url="%s://%s:%s" % (protocol, fakes3.hostname, to_text(fakes3.port)),
|
if port is None:
|
||||||
use_ssl=fakes3.scheme == 'fakes3s', region_name=None, **aws_connect_kwargs)
|
port = 80
|
||||||
|
params = dict(module=module, conn_type='client', resource='s3', region=location,
|
||||||
|
endpoint="%s://%s:%s" % (protocol, fakes3.hostname, to_text(port)),
|
||||||
|
use_ssl=fakes3.scheme == 'fakes3s', **aws_connect_kwargs)
|
||||||
elif is_walrus(s3_url):
|
elif is_walrus(s3_url):
|
||||||
walrus = urlparse(s3_url).hostname
|
walrus = urlparse(s3_url).hostname
|
||||||
params = dict(module=module, conn_type='client', resource='s3', region=location, endpoint=walrus, **aws_connect_kwargs)
|
params = dict(module=module, conn_type='client', resource='s3', region=location, endpoint=walrus, **aws_connect_kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue