From 6f8dbdd5475568f236dffa7b1bda503f404f7256 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 8 Mar 2016 14:49:18 -0500 Subject: [PATCH] Fixing minor logic error in error detection/handling in ssh connection plugin If max retries were reached, no AnsibleConnectionFailure was raised, which means potentially in some cases an unreachable error might not be returned --- lib/ansible/plugins/connection/ssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index b4e6729ee4a..fc67db12b2f 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -601,7 +601,7 @@ class Connection(ConnectionBase): # 0 = success # 1-254 = remote command return code # 255 = failure from the ssh command itself - if return_tuple[0] != 255 or attempt == (remaining_tries - 1): + if return_tuple[0] != 255: break else: raise AnsibleConnectionFailure("Failed to connect to the host via ssh.")