mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -07:00
make timeout decorator for facts have a configurable duration (#16551)
* Add a gather_timeout parameter * update example ansible.cfg * fix play level fact gathering too
This commit is contained in:
parent
ebd3eeec8c
commit
fe8258a378
5 changed files with 24 additions and 0 deletions
|
@ -156,10 +156,14 @@ class PlayIterator:
|
|||
|
||||
# Default options to gather
|
||||
gather_subset = C.DEFAULT_GATHER_SUBSET
|
||||
gather_timeout = C.DEFAULT_GATHER_TIMEOUT
|
||||
|
||||
# Retrieve subset to gather
|
||||
if self._play.gather_subset is not None:
|
||||
gather_subset = self._play.gather_subset
|
||||
# Retrieve timeout for gather
|
||||
if self._play.gather_timeout is not None:
|
||||
gather_timeout = self._play.gather_timeout
|
||||
|
||||
setup_block = Block(play=self._play)
|
||||
setup_task = Task(block=setup_block)
|
||||
|
@ -168,6 +172,8 @@ class PlayIterator:
|
|||
setup_task.args = {
|
||||
'gather_subset': gather_subset,
|
||||
}
|
||||
if gather_timeout:
|
||||
setup_task.args['gather_timeout'] = gather_timeout
|
||||
setup_task.set_loader(self._play._loader)
|
||||
setup_block.block = [setup_task]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue