mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Support setting persistent command timeout per task basis (#42847)
* Support setting persistent command timeout per task basis Fixes #42200 * Add variable `ansible_command_timeout` to `persistent_command_timeout` option for `network_cli` and `netconf` connection plugin so that the command_timeout can be set per task basis while using `connection=network_cli` or `connection=netconf` eg: ``` - name: run copy command ios_command: commands: - show version vars: ansible_command_timeout: 40 ``` * Modify `ansible-connection` to read command_timeout value from connection plugin options. * Add `ansible_command_timeout` to `persistent_command_timeout` option in `persistent` to support `connection=local` so that it is backward compatibilty * To support `connection=local` pass the timeout value as variables from persistent connection to `ansible-connection` instead of sending it in playcontext * Fix CI failure * Fix review comment
This commit is contained in:
parent
5e20ef1d89
commit
97d4e53131
25 changed files with 72 additions and 34 deletions
|
@ -26,6 +26,8 @@ options:
|
|||
key: command_timeout
|
||||
env:
|
||||
- name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT
|
||||
vars:
|
||||
- name: ansible_command_timeout
|
||||
"""
|
||||
import os
|
||||
import pty
|
||||
|
@ -119,7 +121,7 @@ class Connection(ConnectionBase):
|
|||
stdin.write(src)
|
||||
stdin.write(b'\n#END_INIT#\n')
|
||||
|
||||
src = cPickle.dumps({}, protocol=0)
|
||||
src = cPickle.dumps({'ansible_command_timeout': self.get_option('persistent_command_timeout')}, protocol=0)
|
||||
stdin.write(src)
|
||||
stdin.write(b'\n#END_VARS#\n')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue