On Oct 2, 2013, at 10:00 AM, [email protected] wrote:

> On 01:31 pm, [email protected] wrote:
>> 
>> On Oct 2, 2013, at 9:20 AM, [email protected] wrote:
>>> On 01:21 am, [email protected] wrote:
>>>> I have two pieces of code (see: 
>>>> https://gist.github.com/dstufft/9dc9978dc0af77e82f0c) one "works" (in that 
>>>> it fails verifying the host key like i'd expect) and one doesn't ("it 
>>>> never tries to verify the host key and just exists immediately).
>>>> 
>>>> I don't understand *why* though, why does the connectionReady dance make 
>>>> it work?
>>> 
>>> Where's the second piece of code?
>>> 
>>> Jean-Paul
>> 
>> 
>> Both are in the gist, works.py and fails.py
> 
> Oops, sorry.  The second one disappeared when I clicked the "raw" link I 
> guess.
> 
> In the first version, you `react` until `connectProtocol`'s Deferred fires.  
> That's immediately upon the TCP connection setup success - before any 
> appreciable SSH happens.
> 
> In the second version, you `react` indefinitely (because `connectionReady` 
> never fires) giving SSH ample time to handshake.

ah ha, So for a real workload instead of a connectionReady you'd probably 
addCallback a deferred that waits for the SSH to connect and does the work.

> 
> BTW, I'm not sure what you plan to do with this connection, but if you 
> haven't seen `twisted.conch.endpoints` (and <https://tm.tl/6617>) then you 
> probably want to look.

I've seen the endpoints (and even have a version of this working with it). 
Essentially what i'm trying to do is connect to up to ~200 some SSH hosts and 
run a bunch of commands on them (and possibly do things like download files). I 
have this somewhat working with the command endpoint but the snag in that plan 
is I don't always have direct access to these servers so I need to "gateway" 
through another SSH host.

I tried to get this working with the command endpoint but I ended up very 
confused about how the entire thing worked (and I was never able to get the 
gatewaying working). After some frustration in #twisted I decided to start over 
and try to grok all the code (and the underlying stuff as well) before just 
copy/pasting stuff from the examples. Which is where I'm at now.

> 
> Jean-Paul
> 
> _______________________________________________
> Twisted-Python mailing list
> [email protected]
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to