1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
James Cammarata 2016-03-08 14:49:18 -05:00
parent f0d3284ead
commit 1a5ee115f0

View file

@ -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.")