mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Just use netloc to identify bucket name for s3 locations (#2713)
This commit is contained in:
parent
43ea275856
commit
f7ac1f7f90
1 changed files with 2 additions and 2 deletions
|
@ -235,7 +235,7 @@ class MavenDownloader:
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
if parsed_url.scheme=='s3':
|
if parsed_url.scheme=='s3':
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
bucket_name = parsed_url.netloc[:parsed_url.netloc.find('.')]
|
bucket_name = parsed_url.netloc
|
||||||
key_name = parsed_url.path[1:]
|
key_name = parsed_url.path[1:]
|
||||||
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
||||||
url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10)
|
url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10)
|
||||||
|
@ -387,4 +387,4 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue