lordmauve / chopsticks

Chopsticks is an orchestration library: it lets you execute Python code on remote hosts over SSH.
https://chopsticks.readthedocs.io/
Apache License 2.0
158 stars 16 forks source link

can not call simple commands #62

Open madisvain opened 6 years ago

madisvain commented 6 years ago

The first example with calling time works perfectly. But when I try to do other simple things such as:

print(ssh.call(sys.version_info))

then the following exception is raised:

_pickle.PicklingError: Can't pickle <class 'sys.version_info'>: it's not the same object as sys.version_info

Also when getting a bit more complex:

print(ssh.call(subprocess.check_output, "apt-get update", shell=True).raise_failures())
Traceback (most recent call last):
  File "sticks.py", line 23, in <module>
    print(ssh.call(subprocess.check_output, "apt-get update", shell=True).raise_failures())
  File "/Users/konstruktor/.local/share/virtualenvs/shipit-WRCZ5US3/lib/python3.6/site-packages/chopsticks/tunnel.py", line 291, in call
    raise RemoteException(ret.msg)

I'm tunneling into a Ubuntu 18.04 machine. With SSHTunnel.

rhizoome commented 4 years ago

You have to redirect stdout stdout=sys.stderr otherwise the output of the command will break the protocol.