[stable-2.8] paramiko_ssh - Improve authentication error message (#64157) (#64165)

The error is not always an invalid username/password. It could be a connection timeout or refusal.
(cherry picked from commit d5fbe6573b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
pull/64126/head
Sam Doran 6 years ago committed by Matt Davis
parent 8b5cd5b64c
commit 6749ffe824

@ -0,0 +1,2 @@
bugfixes:
- paramiko_ssh - improve authentication error message so it is less confusing

@ -354,7 +354,7 @@ class Connection(ConnectionBase):
except paramiko.ssh_exception.BadHostKeyException as e:
raise AnsibleConnectionFailure('host key mismatch for %s' % e.hostname)
except paramiko.ssh_exception.AuthenticationException as e:
msg = 'Invalid/incorrect username/password. {0}'.format(to_text(e))
msg = 'Failed to authenticate: {0}'.format(to_text(e))
raise AnsibleAuthenticationFailure(msg)
except Exception as e:
msg = to_text(e)

Loading…
Cancel
Save