summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGanesh Nalawade <ganesh634@gmail.com>2018-07-20 10:04:53 +0530
committerGitHub <noreply@github.com>2018-07-20 10:04:53 +0530
commit97d4e5313121b6503e4fcf93ec20f5b9e93f4224 (patch)
tree0003e2cebc132a14a33f9bcf3f3889c5925cd29d /bin
parent5e20ef1d8999baff26252dbd372aafb1d4b55499 (diff)
downloadansible-97d4e5313121b6503e4fcf93ec20f5b9e93f4224.tar.gz
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
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-connection5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/ansible-connection b/bin/ansible-connection
index f387199d82..f77e3f2fe6 100755
--- a/bin/ansible-connection
+++ b/bin/ansible-connection
@@ -119,7 +119,7 @@ class ConnectionProcess(object):
if not data:
break
- signal.alarm(self.connection._play_context.timeout)
+ signal.alarm(self.connection.get_option('persistent_command_timeout'))
resp = self.srv.handle_request(data)
signal.alarm(0)
@@ -146,7 +146,7 @@ class ConnectionProcess(object):
self.shutdown()
def command_timeout(self, signum, frame):
- display.display('command timeout triggered, timeout value is %s secs' % self.play_context.timeout, log_only=True)
+ display.display('command timeout triggered, timeout value is %s secs' % self.connection.get_option('persistent_command_timeout'), log_only=True)
self.shutdown()
def handler(self, signum, frame):
@@ -273,6 +273,7 @@ def main():
else:
messages.append('found existing local domain socket, using it!')
conn = Connection(socket_path)
+ conn.set_options(var_options=variables)
pc_data = to_text(init_data)
try:
messages.extend(conn.update_play_context(pc_data))