I have adapted t.c.s.cftp and one of the ssh examples to transfer files to a 
remote host and than execute some commands there.
Both has to be done for several remote hosts in sequence.
Start of the ssh session has to wait until the cftp sessions are complete and 
after that has completed, the cftp session for the next host has to be started 
. . .

The cftp part begins so:

def distributeStuff(host, tasks):
    . . .
    doConnect(reactor, options, tasks)


def doConnect(reactor, options, tasks):
    . . .
    conn.tasks = tasks
    vhk = verifyHostKey
    uao = SSHUserAuthClient(options['user'], options, conn)
    connect(host, port, options, vhk, uao).addErrback(_ebExit)

class SSHConn(connection.SSHConnection):
    def serviceStarted(self):
        self.openChannel(SSHSession())

I played with inlineCallbacks but could not find a point where to place my 
yielded function.
I tried to overwrite channelClosed in SSHConn:

    def channelClosed(self, channel):
        super(SSHConn, self).channelClosed(channel)
        if len(self.channels) == 0:
            print ‚[Last channel closed.]'
            # open ssh ssession:
            . . .
 but that gave an unhandled error:
2014-10-14 07:54:34+0200 [SSHService ssh-connection on 
SSHClientTransport,client] Unhandled Error
        Traceback (most recent call last):
          File 
"/usr/local/py_venv/p27/lib/python2.7/site-packages/twisted/internet/tcp.py", 
line 214, in doRead
            return self._dataReceived(data)
          File 
"/usr/local/py_venv/p27/lib/python2.7/site-packages/twisted/internet/tcp.py", 
line 220, in _dataReceived
            rval = self.protocol.dataReceived(data)
          File 
"/usr/local/py_venv/p27/lib/python2.7/site-packages/twisted/conch/ssh/transport.py",
 line 461, in dataReceived
            self.dispatchMessage(messageNum, packet[1:])
          File 
"/usr/local/py_venv/p27/lib/python2.7/site-packages/twisted/conch/ssh/transport.py",
 line 483, in dispatchMessage
            messageNum, payload)
        --- <exception caught here> ---
          File 
"/usr/local/py_venv/p27/lib/python2.7/site-packages/twisted/python/log.py", 
line 88, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File „/usr/local/py_venv/p27/lib/python2.7/site-p
(bt stopped here).

Please advise!

Thanks, Axel
—
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius


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

Reply via email to