RPyC and EC2

44 views
Skip to first unread message

Brian Pribis

unread,
Jun 25, 2015, 9:55:54 AM6/25/15
to rp...@googlegroups.com
I'm simply trying to get the sample running for doing RPC over SSH:

from rpyc.utils.zerodeploy import DeployedServer
from plumbum import SshMachine

# create the deployment
mach = SshMachine("stage.myhost.com")
server = DeployedServer(mach)

# and now you can connect to it the usual way
conn1 = server.classic_connect()
print conn1.modules.sys.platform

conn2 = server.classic_connect()
print conn2.modules.os.getpid()

# when you're done - close the server and everything will disappear
server.close()

This connecting to an EC2 from our local network. I actually opened up all my UDP/TCP ports to the world to see if that was the issue (clearly I wouldn't want that even if it did work, but I was just trying to rule out a firewall issue).  Either way I get:

Enter passphrase for key '/home/brian/.ssh/id_dsa':
Traceback (most recent call last):
  File "./test_stage.py", line 7, in <module>
    mach = SshMachine("stage")
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/ssh_machine.py", line 106, in __init__
    new_session = new_session)
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/remote.py", line 129, in __init__
    self._session = self.session(new_session = new_session)
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/ssh_machine.py", line 150, in session
    self.encoding, isatty, self.connect_timeout)
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 141, in __init__
    self.run("")
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 224, in run
    return run_proc(self.popen(cmd), retcode)
  File "/usr/local/lib/python2.7/dist-packages/plumbum/commands/processes.py", line 186, in run_proc
    stdout, stderr = proc.communicate()
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 92, in communicate
    line = pipe.readline()
  File "/usr/local/lib/python2.7/dist-packages/plumbum/machines/session.py", line 40, in readline
    line = self.pipe.readline()
ValueError: I/O operation on closed file


I know that once the SSH connection is made, a random port is setup to tunnel with, so maybe that is the issue,  but I'm not entirely sure.

Any push in the right direction would be helpful.

brian

Reply all
Reply to author
Forward
0 new messages