summaryrefslogtreecommitdiff
path: root/paramiko/client.py
diff options
context:
space:
mode:
authorJeremy T. Bouse <jbouse@debian.org>2014-02-14 21:29:58 -0500
committerJeremy T. Bouse <jbouse@debian.org>2014-02-14 21:29:58 -0500
commit3bb46c9cb414ca82afab715d2d0cc00ed71cfb6d (patch)
tree968464cb0214980291af70f9d1756d907b35aa6c /paramiko/client.py
parent1a716ed46d1d556d4ba6798608ab498320acd886 (diff)
downloadpython-paramiko-3bb46c9cb414ca82afab715d2d0cc00ed71cfb6d.tar
python-paramiko-3bb46c9cb414ca82afab715d2d0cc00ed71cfb6d.tar.gz
Imported Upstream version 1.12.2upstream/1.12.2
Diffstat (limited to 'paramiko/client.py')
-rw-r--r--paramiko/client.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/paramiko/client.py b/paramiko/client.py
index 5b71958..be89609 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -7,7 +7,7 @@
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
-# Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
@@ -186,8 +186,13 @@ class SSHClient (object):
@raise IOError: if the file could not be written
"""
+
+ # update local host keys from file (in case other SSH clients
+ # have written to the known_hosts file meanwhile.
+ if self._host_keys_filename is not None:
+ self.load_host_keys(self._host_keys_filename)
+
f = open(filename, 'w')
- f.write('# SSH host keys collected by paramiko\n')
for hostname, keys in self._host_keys.iteritems():
for keytype, key in keys.iteritems():
f.write('%s %s %s\n' % (hostname, keytype, key.get_base64()))