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
pull/14870/head
James Cammarata 9 years ago
parent f0d3284ead
commit 1a5ee115f0

@ -591,7 +591,7 @@ class Connection(ConnectionBase):
# 0 = success # 0 = success
# 1-254 = remote command return code # 1-254 = remote command return code
# 255 = failure from the ssh command itself # 255 = failure from the ssh command itself
if return_tuple[0] != 255 or attempt == (remaining_tries - 1): if return_tuple[0] != 255:
break break
else: else:
raise AnsibleConnectionFailure("Failed to connect to the host via ssh.") raise AnsibleConnectionFailure("Failed to connect to the host via ssh.")

Loading…
Cancel
Save