Merge remote-tracking branch 'master/master' into py3-support-without-py25
Conflicts: paramiko/__init__.py setup.py tests/test_client.py
This commit is contained in:
commit
b9e62182e5
|
@ -11,5 +11,9 @@ script: python test.py --verbose
|
||||||
notifications:
|
notifications:
|
||||||
irc:
|
irc:
|
||||||
channels: "irc.freenode.org#paramiko"
|
channels: "irc.freenode.org#paramiko"
|
||||||
|
template:
|
||||||
|
- "%{repository}@%{branch}: %{message} (%{build_url})"
|
||||||
on_success: change
|
on_success: change
|
||||||
on_failure: change
|
on_failure: change
|
||||||
|
use_notice: true
|
||||||
|
email: false
|
||||||
|
|
23
NEWS
23
NEWS
|
@ -12,6 +12,29 @@ Issues noted as "Fabric #NN" can be found at https://github.com/fabric/fabric/.
|
||||||
Releases
|
Releases
|
||||||
========
|
========
|
||||||
|
|
||||||
|
v1.12.1 (8th Jan 2014)
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
* #176: Fix AttributeError bugs in known_hosts file (re)loading. Thanks to
|
||||||
|
Nathan Scowcroft for the patch & Martin Blumenstingl for the initial test
|
||||||
|
case.
|
||||||
|
* #225: Note ecdsa requirement in README. Thanks to Amaury Rodriguez for the
|
||||||
|
catch.
|
||||||
|
|
||||||
|
v1.11.3 (8th Jan 2014)
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
* #176: Fix AttributeError bugs in known_hosts file (re)loading. Thanks to
|
||||||
|
Nathan Scowcroft for the patch & Martin Blumenstingl for the initial test
|
||||||
|
case.
|
||||||
|
|
||||||
|
v1.10.5 (8th Jan 2014)
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
* #176: Fix AttributeError bugs in known_hosts file (re)loading. Thanks to
|
||||||
|
Nathan Scowcroft for the patch & Martin Blumenstingl for the initial test
|
||||||
|
case.
|
||||||
|
|
||||||
v1.12.0 (27th Sep 2013)
|
v1.12.0 (27th Sep 2013)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
3
README
3
README
|
@ -5,7 +5,7 @@ paramiko
|
||||||
|
|
||||||
:Paramiko: Python SSH module
|
:Paramiko: Python SSH module
|
||||||
:Copyright: Copyright (c) 2003-2009 Robey Pointer <robeypointer@gmail.com>
|
:Copyright: Copyright (c) 2003-2009 Robey Pointer <robeypointer@gmail.com>
|
||||||
:Copyright: Copyright (c) 2013 Jeff Forcier <jeff@bitprophet.org>
|
:Copyright: Copyright (c) 2014 Jeff Forcier <jeff@bitprophet.org>
|
||||||
:License: LGPL
|
:License: LGPL
|
||||||
:Homepage: https://github.com/paramiko/paramiko/
|
:Homepage: https://github.com/paramiko/paramiko/
|
||||||
:API docs: http://docs.paramiko.org
|
:API docs: http://docs.paramiko.org
|
||||||
|
@ -36,6 +36,7 @@ Requirements
|
||||||
|
|
||||||
- python 2.6 or better <http://www.python.org/>
|
- python 2.6 or better <http://www.python.org/>
|
||||||
- pycrypto 2.1 or better <https://www.dlitz.net/software/pycrypto/>
|
- pycrypto 2.1 or better <https://www.dlitz.net/software/pycrypto/>
|
||||||
|
- ecdsa 0.9 or better <https://pypi.python.org/pypi/ecdsa>
|
||||||
|
|
||||||
If you have setuptools, you can build and install paramiko and all its
|
If you have setuptools, you can build and install paramiko and all its
|
||||||
dependencies with this command (as root)::
|
dependencies with this command (as root)::
|
||||||
|
|
|
@ -189,8 +189,8 @@ class SSHClient (object):
|
||||||
|
|
||||||
# update local host keys from file (in case other SSH clients
|
# update local host keys from file (in case other SSH clients
|
||||||
# have written to the known_hosts file meanwhile.
|
# have written to the known_hosts file meanwhile.
|
||||||
if self.known_hosts is not None:
|
if self._host_keys_filename is not None:
|
||||||
self.load_host_keys(self.known_hosts)
|
self.load_host_keys(self._host_keys_filename)
|
||||||
|
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
for hostname, keys in self._host_keys.items():
|
for hostname, keys in self._host_keys.items():
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
Some unit tests for SSHClient.
|
Some unit tests for SSHClient.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
import weakref
|
import weakref
|
||||||
|
import warnings
|
||||||
|
import os
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from tests.util import test_path
|
from tests.util import test_path
|
||||||
import paramiko
|
import paramiko
|
||||||
|
@ -186,7 +187,33 @@ class SSHClientTest (unittest.TestCase):
|
||||||
self.assertEqual(1, len(self.tc.get_host_keys()))
|
self.assertEqual(1, len(self.tc.get_host_keys()))
|
||||||
self.assertEqual(public_host_key, self.tc.get_host_keys()['[%s]:%d' % (self.addr, self.port)]['ssh-rsa'])
|
self.assertEqual(public_host_key, self.tc.get_host_keys()['[%s]:%d' % (self.addr, self.port)]['ssh-rsa'])
|
||||||
|
|
||||||
def test_5_cleanup(self):
|
def test_5_save_host_keys(self):
|
||||||
|
"""
|
||||||
|
verify that SSHClient correctly saves a known_hosts file.
|
||||||
|
"""
|
||||||
|
warnings.filterwarnings('ignore', 'tempnam.*')
|
||||||
|
|
||||||
|
host_key = paramiko.RSAKey.from_private_key_file('tests/test_rsa.key')
|
||||||
|
public_host_key = paramiko.RSAKey(data=str(host_key))
|
||||||
|
localname = os.tempnam()
|
||||||
|
|
||||||
|
client = paramiko.SSHClient()
|
||||||
|
self.assertEquals(0, len(client.get_host_keys()))
|
||||||
|
|
||||||
|
host_id = '[%s]:%d' % (self.addr, self.port)
|
||||||
|
|
||||||
|
client.get_host_keys().add(host_id, 'ssh-rsa', public_host_key)
|
||||||
|
self.assertEquals(1, len(client.get_host_keys()))
|
||||||
|
self.assertEquals(public_host_key, client.get_host_keys()[host_id]['ssh-rsa'])
|
||||||
|
|
||||||
|
client.save_host_keys(localname)
|
||||||
|
|
||||||
|
with open(localname) as fd:
|
||||||
|
assert host_id in fd.read()
|
||||||
|
|
||||||
|
os.unlink(localname)
|
||||||
|
|
||||||
|
def test_6_cleanup(self):
|
||||||
"""
|
"""
|
||||||
verify that when an SSHClient is collected, its transport (and the
|
verify that when an SSHClient is collected, its transport (and the
|
||||||
transport's packetizer) is closed.
|
transport's packetizer) is closed.
|
||||||
|
|
Loading…
Reference in New Issue