mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add a timeout to the synchronize module to prevent infinite hangs while waiting on passwords for misconfigured users
This commit is contained in:
parent
9972265fd3
commit
0adf095677
1 changed files with 3 additions and 1 deletions
|
@ -150,6 +150,7 @@ def main():
|
||||||
times = dict(type='bool'),
|
times = dict(type='bool'),
|
||||||
owner = dict(type='bool'),
|
owner = dict(type='bool'),
|
||||||
group = dict(type='bool'),
|
group = dict(type='bool'),
|
||||||
|
rsync_timeout = dict(type='int', default=10)
|
||||||
),
|
),
|
||||||
supports_check_mode = True
|
supports_check_mode = True
|
||||||
)
|
)
|
||||||
|
@ -160,6 +161,7 @@ def main():
|
||||||
private_key = module.params['private_key']
|
private_key = module.params['private_key']
|
||||||
rsync_path = module.params['rsync_path']
|
rsync_path = module.params['rsync_path']
|
||||||
rsync = module.params.get('local_rsync_path', 'rsync')
|
rsync = module.params.get('local_rsync_path', 'rsync')
|
||||||
|
rsync_timeout = module.params.get('rsync_timeout', 'rsync_timeout')
|
||||||
archive = module.params['archive']
|
archive = module.params['archive']
|
||||||
dirs = module.params['dirs']
|
dirs = module.params['dirs']
|
||||||
# the default of these params depends on the value of archive
|
# the default of these params depends on the value of archive
|
||||||
|
@ -170,7 +172,7 @@ def main():
|
||||||
owner = module.params['owner']
|
owner = module.params['owner']
|
||||||
group = module.params['group']
|
group = module.params['group']
|
||||||
|
|
||||||
cmd = '%s --delay-updates --compress' % rsync
|
cmd = '%s --delay-updates --compress --timeout=%s' % (rsync, rsync_timeout)
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
cmd = cmd + ' --dry-run'
|
cmd = cmd + ' --dry-run'
|
||||||
if delete:
|
if delete:
|
||||||
|
|
Loading…
Reference in a new issue