From d5fbe6573b47d51dfb4bd45da580c62032a14c11 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Thu, 31 Oct 2019 15:39:53 -0400 Subject: [PATCH] paramiko_ssh - Improve authentication error message (#64157) The error is not always an invalid username/password. It could be a connection timeout or refusal. --- changelogs/fragments/paramiko_ssh-improve-error-message.yaml | 2 ++ lib/ansible/plugins/connection/paramiko_ssh.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/paramiko_ssh-improve-error-message.yaml diff --git a/changelogs/fragments/paramiko_ssh-improve-error-message.yaml b/changelogs/fragments/paramiko_ssh-improve-error-message.yaml new file mode 100644 index 00000000000..dea10ccd972 --- /dev/null +++ b/changelogs/fragments/paramiko_ssh-improve-error-message.yaml @@ -0,0 +1,2 @@ +bugfixes: + - paramiko_ssh - improve authentication error message so it is less confusing diff --git a/lib/ansible/plugins/connection/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py index 4f8b903cb38..ce47b74bbc1 100644 --- a/lib/ansible/plugins/connection/paramiko_ssh.py +++ b/lib/ansible/plugins/connection/paramiko_ssh.py @@ -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)