From 1a5ee115f0b0677de38dc60091530859a76dee13 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 328ace5537..c24a5623ed 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -591,7 +591,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.")