From bb28719541bac177a8c64e913d36cbef34582b52 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Thu, 24 Jan 2019 23:53:01 +0530 Subject: [PATCH] fix ansible_connect_timeout variable in connection plugins and nxos_install_os timeout check (#51209) * fix ansible_connect_timeout variable in connection plugins and nxos_install_os timeout check (#50965) Signed-off-by: Trishna Guha (cherry picked from commit a1ea7e430ab3a80b5d662cb91c97b656734c5747) * changelog Signed-off-by: Trishna Guha --- changelogs/fragments/fix_ansible_connect_timeout.yaml | 2 ++ lib/ansible/plugins/action/nxos.py | 3 ++- lib/ansible/plugins/connection/httpapi.py | 2 ++ lib/ansible/plugins/connection/netconf.py | 2 ++ lib/ansible/plugins/connection/network_cli.py | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix_ansible_connect_timeout.yaml diff --git a/changelogs/fragments/fix_ansible_connect_timeout.yaml b/changelogs/fragments/fix_ansible_connect_timeout.yaml new file mode 100644 index 00000000000..49860be231a --- /dev/null +++ b/changelogs/fragments/fix_ansible_connect_timeout.yaml @@ -0,0 +1,2 @@ +bugfixes: +- fix ansible_connect_timeout variable in network_cli,netconf,httpapi and nxos_install_os timeout check diff --git a/lib/ansible/plugins/action/nxos.py b/lib/ansible/plugins/action/nxos.py index e9230b25906..8598530de90 100644 --- a/lib/ansible/plugins/action/nxos.py +++ b/lib/ansible/plugins/action/nxos.py @@ -56,7 +56,8 @@ class ActionModule(_ActionModule): self._task.args['username'] = self._play_context.connection_user if self._task.action == 'nxos_install_os': - if C.PERSISTENT_COMMAND_TIMEOUT < 600 or C.PERSISTENT_CONNECT_TIMEOUT < 600: + connection = self._connection + if connection.get_option('persistent_command_timeout') < 600 or connection.get_option('persistent_connect_timeout') < 600: msg = 'PERSISTENT_COMMAND_TIMEOUT and PERSISTENT_CONNECT_TIMEOUT' msg += ' must be set to 600 seconds or higher when using nxos_install_os module' return {'failed': True, 'msg': msg} diff --git a/lib/ansible/plugins/connection/httpapi.py b/lib/ansible/plugins/connection/httpapi.py index 78f10112d8d..b96a2a60821 100644 --- a/lib/ansible/plugins/connection/httpapi.py +++ b/lib/ansible/plugins/connection/httpapi.py @@ -127,6 +127,8 @@ options: key: connect_timeout env: - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT + vars: + - name: ansible_connect_timeout persistent_command_timeout: type: int description: diff --git a/lib/ansible/plugins/connection/netconf.py b/lib/ansible/plugins/connection/netconf.py index 2dcaaf4d69d..e8a9102d4b5 100644 --- a/lib/ansible/plugins/connection/netconf.py +++ b/lib/ansible/plugins/connection/netconf.py @@ -140,6 +140,8 @@ options: key: connect_timeout env: - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT + vars: + - name: ansible_connect_timeout persistent_command_timeout: type: int description: diff --git a/lib/ansible/plugins/connection/network_cli.py b/lib/ansible/plugins/connection/network_cli.py index a7b075e644b..f6a0960c970 100644 --- a/lib/ansible/plugins/connection/network_cli.py +++ b/lib/ansible/plugins/connection/network_cli.py @@ -142,6 +142,8 @@ options: key: connect_timeout env: - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT + vars: + - name: ansible_connect_timeout persistent_command_timeout: type: int description: