From 9a3dc5f7984e12bf408ed5fb337e80657edde8e4 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Wed, 26 Jun 2019 21:23:07 +0530 Subject: [PATCH] Fix netconf connection command timeout issue (#58322) * ncclient uses same timeout value at the time of connection initialisation and waiting response * Ansible has connect_timeout to control the waiting time during initial connection and `command_timeout` to control the wait time for resposne. Hence set the ncclient timeout seperately to Ansible command_timeout after the connection object is created sucessfully. (cherry picked from commit db0fe4b1884e6bb9c25e970c7585abb7edd9d664) --- changelogs/fragments/netconf_command_timeout.yaml | 2 ++ lib/ansible/plugins/connection/netconf.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/netconf_command_timeout.yaml diff --git a/changelogs/fragments/netconf_command_timeout.yaml b/changelogs/fragments/netconf_command_timeout.yaml new file mode 100644 index 00000000000..cf7a090982f --- /dev/null +++ b/changelogs/fragments/netconf_command_timeout.yaml @@ -0,0 +1,2 @@ +bugfixes: +- Fix netconf connection command timeout issue (https://github.com/ansible/ansible/pull/58322) diff --git a/lib/ansible/plugins/connection/netconf.py b/lib/ansible/plugins/connection/netconf.py index 0093ec21606..a04b58c0e7a 100644 --- a/lib/ansible/plugins/connection/netconf.py +++ b/lib/ansible/plugins/connection/netconf.py @@ -321,6 +321,8 @@ class Connection(NetworkConnectionBase): timeout=self.get_option('persistent_connect_timeout'), ssh_config=ssh_config ) + + self._manager._timeout = self.get_option('persistent_command_timeout') except SSHUnknownHostError as exc: raise AnsibleConnectionFailure(to_native(exc)) except ImportError as exc: