[Twisted-Python] potential connectSSH workflow
paulswartz at gmail.com
Thu Jul 26 22:51:17 EDT 2007
On 7/26/07, glyph at divmod.com <glyph at divmod.com> wrote:
> This might seem like a lot of typing, so to help with abbreviation, a
> higher-level object could roll them together:
> altdotssh = DotSSH(FilePath("my-dot-ssh-dir"))
> And this leads in to my idea for subtly changing the design. Instead of
> modifying stuff with arguments to the function:
> factory, hostname, hostVerifier=altdotssh.hostVerifier)
> Building a different object takes roughly the same amount of work and
> does roughly the same thing, but yields a result which can be passed
> around and used as a connector:
> endpt = defaultConfig.endpointSSH(
> hostname, hostVerifier=altdotssh.hostVerifier)
So, is defaultConfig is some other object which can create a
ConchEndpoint? Is defaultConfig a DotSSH? I'm not clear on what
these different objects are here.
> To push this flexibility even further, you could make the configuration
> object cloneable.
> cfg2 = defaultConfig.copy(hostVerifier=altdotssh.hostVerifier)
> endpt = cfg2.endpointSSH(hostname)
> although whether this last additional level of flexibility is worth it
> or not probably depends on all of the things that a "configuration"
> object can contain.
This seems reasonable, at least for the case of host verification.
I'm not sure where authentication fits into these things, though. It
feels different from host key verification, but moving it to the
connect() method makes the ConchEndpoint a different interface from
the other Endpoints. I suppose with a copy method:
is straightforward enough. But it seems more confusing than:
which seems more in line with my personal expectations. I think,
however, my expectations might be changed if the above example was
more clear to me.
paulswartz at gmail dot com
More information about the Twisted-Python