[MERGE] Support for Putty SSH implementation

Martin Pool mbp at canonical.com
Tue Jan 9 07:06:52 GMT 2007


On  8 Jan 2007, Andrew Bennetts <andrew at canonical.com> wrote:
> >  
> > -_ssh_vendors = {}
> > -
> > -def register_ssh_vendor(name, vendor):
> > -    """Register SSH vendor."""
> > -    _ssh_vendors[name] = vendor
> > -
> > -    
> > -_ssh_vendor = None
> > -def _get_ssh_vendor():
> > -    """Find out what version of SSH is on the system."""
> > -    global _ssh_vendor
> > -    if _ssh_vendor is not None:
> > -        return _ssh_vendor
> > -
> > -    if 'BZR_SSH' in os.environ:
> > -        vendor_name = os.environ['BZR_SSH']
> > +
> > +class SSHVendorManager(object):
> > +    """Manager for manage SSH vendors."""
> 
> Hmm, it's tempting to making this a bzrlib.registry.Registry, until you realise
> that the interface doesn't quite fit; instead of "get(key)" this essentially
> just has "get()", which chooses the best registered vendor for the current
> environment (I mean environment in the broader sense, not just the "os.environ"
> sense).
> 
> It may be worth adding a brief comment highlighting this fundamental difference,
> to stop people (like me) from chasing foolish consistency by trying reuse
> Registry here :)

Yes, or could we have it backed by a Registry but with the autodetection
or BZR_SSH behaviour layered on top?

-- 
Martin



More information about the bazaar mailing list