[BUG] NameError: global name 'ssh' is not defined
John Arbash Meinel
john at arbash-meinel.com
Wed Sep 13 16:51:33 BST 2006
Andrew Bennetts wrote:
> Alexander Belchenko wrote:
>> On my win32:
>> The problem occurs when I try to access to another branch via sftp:
>> File "E:\Bazaar\devel\bzr.dev\bzrlib\transport\ssh.py", line 104, in
>> _ssh_vendor = ssh.ParamikoVendor()
>> NameError: global name 'ssh' is not defined
> Oops, this would appear to be my fault. I guess this means that the fallback to
> paramiko (when OpenSSH is not available) was broken by my recent refactoring of
> this code.
> I've attached a bundle that should fix this, and a couple of other pyflakes
> nits in those files. Clearly the tests are lacking though; we should probably
> make it so the ParamikoVendor is always tested, regardless of whether OpenSSH is
> available. Or rather, test *every* available SSH implementation (and paramiko
> is a hard dependency, so it's always available).
Well, we had a 'make sure we can do a real connection' test. But that
might just use whatever implementation is available.
Specifically, in bzrlib/tests/test_sftp_tranpsort.py we have:
"""Test that the ssh vendors can all connect.
Verify that a full-handshake (SSH over loopback TCP) sftp connection
We have 3 sftp implementations in the test suite:
'loopback': Doesn't use ssh, just uses a local socket. Most tests are
done this way to save the handshaking time, so it is not
tested again here
'none': This uses paramiko's built-in ssh client and server,
sftp on top of it.
None: If 'ssh' exists on the machine, then it will be
spawned as a
So we do test that we can actually connect with each. But unfortunately
it is done by manually setting 'self._test_vendor = ssh.ParamikoVendor'.
So we know that we can connect with at least Paramiko and loopback (I
don't think we are testing None.)
What we need is a test of _get_ssh_vendor(). We could restrict the path
to just the local working directory, which will force 'ssh -V' to fail,
and that can check that we fall back to paramiko.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060913/1b120ce2/attachment.pgp
More information about the bazaar