Skip to content

Commit

Permalink
prevent a paramiko AttributeError in SSHClient
Browse files Browse the repository at this point in the history
There's a bug in the paramiko library that causes an AttributeError when
paramiko is looking for a known_hosts attribute on SSHClient.

paramiko/paramiko#176
paramiko/paramiko#214
paramiko/paramiko#220
  • Loading branch information
kanzure committed Dec 27, 2013
1 parent 5263b20 commit 77b8137
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boto/manage/cmdshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def __init__(self, server,
self._pkey = paramiko.RSAKey.from_private_key_file(server.ssh_key_file,
password=ssh_pwd)
self._ssh_client = paramiko.SSHClient()

# This prevents an AttributeError in paramiko 1.12.0 (and probably
# other versions).
# https://github.com/paramiko/paramiko/pull/176
# https://github.com/paramiko/paramiko/pull/214
# https://github.com/paramiko/paramiko/issues/220
self._ssh_client.known_hosts = None

self._ssh_client.load_system_host_keys()
self._ssh_client.load_host_keys(os.path.expanduser(host_key_file))
self._ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
Expand Down

0 comments on commit 77b8137

Please sign in to comment.