diff options
author | Loic Dachary <loic@dachary.org> | 2014-09-25 21:32:19 +0200 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2015-09-30 14:12:41 -0700 |
commit | 3bc8fd1a02358a8647bcee11e652ee5aec0bdf97 (patch) | |
tree | 2ed411f0c44d762dac84d4c821d7a4e47bf5c075 | |
parent | e9d65f4199bb6a8589c9a89f8a8d68edd66ac6d0 (diff) |
Add informative BadHostKeyException
Displaying the keys being compared makes it easy to diagnose the
problem. Otherwise there is more guessing involved.
Signed-off-by: Loic Dachary <loic@dachary.org>
-rw-r--r-- | paramiko/ssh_exception.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index b99e42b3..e120a45e 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -105,7 +105,11 @@ class BadHostKeyException (SSHException): .. versionadded:: 1.6 """ def __init__(self, hostname, got_key, expected_key): - SSHException.__init__(self, 'Host key for server %s does not match!' % hostname) + SSHException.__init__(self, + 'Host key for server %s does not match : got %s expected %s' % ( + hostname, + got_key.get_base64(), + expected_key.get_base64())) self.hostname = hostname self.key = got_key self.expected_key = expected_key |