From b0abbb5f8b8707e4b8e44c7f318bac5e1eee5e96 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 17 Feb 2017 07:12:12 -0500 Subject: [PATCH] removes the default kwarg in ios_argument_spec for timeout (#21552) Uses the configured timeout setting instead of the arg_spec fixes #21520 --- lib/ansible/module_utils/ios.py | 2 +- lib/ansible/plugins/action/ios.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py index 45754701aa..62fdefa87f 100644 --- a/lib/ansible/module_utils/ios.py +++ b/lib/ansible/module_utils/ios.py @@ -39,7 +39,7 @@ ios_argument_spec = { 'ssh_keyfile': dict(fallback=(env_fallback, ['ANSIBLE_NET_SSH_KEYFILE']), type='path'), 'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'), 'auth_pass': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS']), no_log=True), - 'timeout': dict(type='int', default=10), + 'timeout': dict(type='int'), 'provider': dict(type='dict'), } diff --git a/lib/ansible/plugins/action/ios.py b/lib/ansible/plugins/action/ios.py index d1257c35ef..a06e29f52a 100644 --- a/lib/ansible/plugins/action/ios.py +++ b/lib/ansible/plugins/action/ios.py @@ -56,6 +56,7 @@ class ActionModule(_ActionModule): pc.port = provider['port'] or self._play_context.port or 22 pc.remote_user = provider['username'] or self._play_context.connection_user pc.password = provider['password'] or self._play_context.password + pc.timeout = provider['timeout'] or self._play_context.timeout pc.become = provider['authorize'] or False pc.become_pass = provider['auth_pass'] @@ -64,7 +65,9 @@ class ActionModule(_ActionModule): socket_path = self._get_socket_path(pc) if not os.path.exists(socket_path): # start the connection if it isn't started - connection.exec_command('EXEC: show version') + rc, out, err = connection.exec_command('open_shell()') + if not rc == 0: + return {'failed': True, 'msg': 'unable to open shell', 'rc': rc} task_vars['ansible_socket'] = socket_path