paramiko_ssh - Improve authentication error message (#64157)

The error is not always an invalid username/password. It could be a connection timeout or refusal.
This commit is contained in:
Sam Doran 2019-10-31 15:39:53 -04:00 committed by GitHub
parent 35c415de98
commit d5fbe6573b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

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

View file

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