diff options
author | jerrejkw <43955357+jerrejkw@users.noreply.github.com> | 2018-10-18 11:37:39 +0200 |
---|---|---|
committer | Abhijeet Kasurde <akasurde@redhat.com> | 2018-10-18 15:07:39 +0530 |
commit | 44044f969df2b7157f2e338de0a8bfd3b1a30053 (patch) | |
tree | 764669582e32b9f649339cd4c420d8f95c6f7933 | |
parent | 92103bf5d034c57e67cdf43f016ce3362a7ca1e5 (diff) | |
download | ansible-44044f969df2b7157f2e338de0a8bfd3b1a30053.tar.gz |
VMware: Add timeout parameter for vmware module vsphere_copy (#46762)
* Enhancement: add timeout parameter for vmware module vsphere_copy
-rw-r--r-- | lib/ansible/modules/cloud/vmware/vsphere_copy.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ansible/modules/cloud/vmware/vsphere_copy.py b/lib/ansible/modules/cloud/vmware/vsphere_copy.py index ff5d0aa536..84ddce5d9b 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_copy.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_copy.py @@ -58,6 +58,12 @@ options: set to C(no) when no other option exists. default: 'yes' type: bool + timeout: + description: + - The timeout in seconds for the upload to the datastore. + default: 10 + type: int + version_added: "2.8" notes: - "This module ought to be run from a system that can access vCenter directly and has the file to transfer. @@ -126,6 +132,7 @@ def main(): datastore=dict(required=True), dest=dict(required=True, aliases=['path']), validate_certs=dict(default=True, type='bool'), + timeout=dict(default=10, type='int') ), # Implementing check-mode using HEAD is impossible, since size/date is not 100% reliable supports_check_mode=False, @@ -139,6 +146,7 @@ def main(): datastore = module.params.get('datastore') dest = module.params.get('dest') validate_certs = module.params.get('validate_certs') + timeout = module.params.get('timeout') fd = open(src, "rb") atexit.register(fd.close) @@ -155,7 +163,7 @@ def main(): } try: - r = open_url(url, data=data, headers=headers, method='PUT', + r = open_url(url, data=data, headers=headers, method='PUT', timeout=timeout, url_username=login, url_password=password, validate_certs=validate_certs, force_basic_auth=True) except socket.error as e: |