mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[aws] Remove walrus conditional in aws_s3 module when using custom s3_url (#36832)
fix aws_s3 module to use custum s3_url.
This commit is contained in:
parent
d2a1b75913
commit
e59742eccd
2 changed files with 3 additions and 14 deletions
3
changelogs/fragments/aws_s3_fix_custom_endpoints.yaml
Normal file
3
changelogs/fragments/aws_s3_fix_custom_endpoints.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- allow custom endpoints to be used in the aws_s3 module (https://github.com/ansible/ansible/pull/36832)
|
|
@ -625,17 +625,6 @@ def is_fakes3(s3_url):
|
|||
return False
|
||||
|
||||
|
||||
def is_walrus(s3_url):
|
||||
""" Return True if it's Walrus endpoint, not S3
|
||||
|
||||
We assume anything other than *.amazonaws.com is Walrus"""
|
||||
if s3_url is not None:
|
||||
o = urlparse(s3_url)
|
||||
return not o.netloc.endswith('amazonaws.com')
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url, sig_4=False):
|
||||
if s3_url and rgw: # TODO - test this
|
||||
rgw = urlparse(s3_url)
|
||||
|
@ -654,9 +643,6 @@ def get_s3_connection(module, aws_connect_kwargs, location, rgw, s3_url, sig_4=F
|
|||
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):
|
||||
walrus = urlparse(s3_url).hostname
|
||||
params = dict(module=module, conn_type='client', resource='s3', region=location, endpoint=walrus, **aws_connect_kwargs)
|
||||
else:
|
||||
params = dict(module=module, conn_type='client', resource='s3', region=location, endpoint=s3_url, **aws_connect_kwargs)
|
||||
if module.params['mode'] == 'put' and module.params['encryption_mode'] == 'aws:kms':
|
||||
|
|
Loading…
Reference in a new issue