maven_artifact: Allow to specify a custom timeout (#2526)
This commit is contained in:
parent
713b9bbdf3
commit
9b9ea97706
1 changed files with 10 additions and 1 deletions
|
@ -102,6 +102,12 @@ options:
|
|||
required: true
|
||||
default: present
|
||||
choices: [present,absent]
|
||||
timeout:
|
||||
description:
|
||||
- Specifies a timeout in seconds for the connection attempt
|
||||
required: false
|
||||
default: 10
|
||||
version_added: '2.2'
|
||||
validate_certs:
|
||||
description:
|
||||
- If C(no), SSL certificates will not be validated. This should only be set to C(no) when no other option exists.
|
||||
|
@ -240,12 +246,14 @@ class MavenDownloader:
|
|||
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)
|
||||
|
||||
req_timeout = self.module.params.get('timeout')
|
||||
|
||||
# Hack to add parameters in the way that fetch_url expects
|
||||
self.module.params['url_username'] = self.module.params.get('username', '')
|
||||
self.module.params['url_password'] = self.module.params.get('password', '')
|
||||
self.module.params['http_agent'] = self.module.params.get('user_agent', None)
|
||||
|
||||
response, info = fetch_url(self.module, url_to_use)
|
||||
response, info = fetch_url(self.module, url_to_use, timeout=req_timeout)
|
||||
if info['status'] != 200:
|
||||
raise ValueError(failmsg + " because of " + info['msg'] + "for URL " + url_to_use)
|
||||
else:
|
||||
|
@ -328,6 +336,7 @@ def main():
|
|||
username = dict(default=None,aliases=['aws_secret_key']),
|
||||
password = dict(default=None, no_log=True,aliases=['aws_secret_access_key']),
|
||||
state = dict(default="present", choices=["present","absent"]), # TODO - Implement a "latest" state
|
||||
timeout = dict(default=10, type='int'),
|
||||
dest = dict(type="path", default=None),
|
||||
validate_certs = dict(required=False, default=True, type='bool'),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue