mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-06 06:04:24 -07:00
VMware: Add timeout parameter for vmware module vsphere_copy (#46762)
* Enhancement: add timeout parameter for vmware module vsphere_copy
This commit is contained in:
parent
92103bf5d0
commit
44044f969d
1 changed files with 9 additions and 1 deletions
|
@ -58,6 +58,12 @@ options:
|
||||||
set to C(no) when no other option exists.
|
set to C(no) when no other option exists.
|
||||||
default: 'yes'
|
default: 'yes'
|
||||||
type: bool
|
type: bool
|
||||||
|
timeout:
|
||||||
|
description:
|
||||||
|
- The timeout in seconds for the upload to the datastore.
|
||||||
|
default: 10
|
||||||
|
type: int
|
||||||
|
version_added: "2.8"
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
- "This module ought to be run from a system that can access vCenter directly and has the file to transfer.
|
- "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),
|
datastore=dict(required=True),
|
||||||
dest=dict(required=True, aliases=['path']),
|
dest=dict(required=True, aliases=['path']),
|
||||||
validate_certs=dict(default=True, type='bool'),
|
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
|
# Implementing check-mode using HEAD is impossible, since size/date is not 100% reliable
|
||||||
supports_check_mode=False,
|
supports_check_mode=False,
|
||||||
|
@ -139,6 +146,7 @@ def main():
|
||||||
datastore = module.params.get('datastore')
|
datastore = module.params.get('datastore')
|
||||||
dest = module.params.get('dest')
|
dest = module.params.get('dest')
|
||||||
validate_certs = module.params.get('validate_certs')
|
validate_certs = module.params.get('validate_certs')
|
||||||
|
timeout = module.params.get('timeout')
|
||||||
|
|
||||||
fd = open(src, "rb")
|
fd = open(src, "rb")
|
||||||
atexit.register(fd.close)
|
atexit.register(fd.close)
|
||||||
|
@ -155,7 +163,7 @@ def main():
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
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,
|
url_username=login, url_password=password, validate_certs=validate_certs,
|
||||||
force_basic_auth=True)
|
force_basic_auth=True)
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue