[MERGE] Refactor loopback/paramiko/openssh/ssh connection opening
Andrew Bennetts
andrew at canonical.com
Tue Aug 29 02:20:46 BST 2006
Martin Pool wrote:
[...]
> > > + def connect_ssh(self, username, password, host, port, command):
> > > + """Make an SSH connection, and return a pipe-like object."""
> > > + raise NotImplementedError(self.connect_ssh)
> > > +
> >
> > ^-- I realize you haven't implemented this yet. but it seems you would
> > need more than a 'pipe-like' object. Either you need 2 pipes for
> > bidirectional support, or you need a socket-like object. Or maybe even a
> > real class.
>
> I think he meant socket-like.
>
> (We may need to be clear about just what methods can be called -- recv
> like a socket, or read like a file?)
Probably socket-like. I'd prefer to defer worrying about the precise interface
until it's actually implemented.
> > > +class LoopbackVendor(SSHVendor):
> > > + """SSH "vendor" that connects over a plain TCP socket, not SSH."""
> > > +
> > > + def connect_sftp(self, username, password, host, port):
> > > + sock = socket.socket()
> > > + try:
> > > + sock.connect((host, port))
> > > + except socket.error, e:
> > > + raise ConnectionError('Unable to connect to SSH host %s:%s: %s'
> > > + % (host, port, e))
> > > + return SFTPClient(LoopbackSFTP(sock))
> > > +
> >
> > ^- loopback is fairly unique, but I think it could be:
>
> In passing I think 'loopback' is an imperfect name, because it doesn't
> really loop back to where it came from. Instead the distinguishing
> feature is that it runs across bare unencrypted tcp.
Agreed. However, this is a naming bug that already exists without these
changes, so I don't think this should block this merge. Someone can easily
enough change it later when they think of a better name (and update all the
references to 'loopback' in tests, presumably).
-Andrew.
More information about the bazaar
mailing list