fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Tunneling Stalls


From: Adrián
Subject: Re: [Fab-user] Tunneling Stalls
Date: Mon, 14 Oct 2013 15:52:01 +0100

No one? I've been trying to work this one out for over a week now, and no matter how I try this doesn't seem to work at all. Any help would be appreciated. If it's a bug I'd also like to know to stop banging my head with the settings. Even using fab tool and a fabfile.py like this:

$ cat fabfile.py
from fabric.api import run

def host_type():
        run('uname -a')


$ fab -f fabfile.py -H host.org:4242 -k host_type --user adrian --gateway address@hidden:22
[host.org:4242] Executing task 'host_type'
[host.org:4242] run: uname -a
[host.org:4242] Login password for 'adrian':
[host.org:4242] Login password for 'adrian':

It stalls there forever. Then I Ctrl-C and get this:

^C
Stopped.
Disconnecting from address@hidden done.

And stalls again.Then I Ctrl-C on that one too and get this:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65, in _join_lingering_threads
    thr.stop_thread()
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395, in stop_thread
    self.join(10)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 653, in join
    self.__block.wait(delay)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 257, in wait
    _sleep(delay)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65, in _join_lingering_threads
    thr.stop_thread()
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395, in stop_thread
    self.join(10)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 653, in join
    self.__block.wait(delay)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 257, in wait
    _sleep(delay)
KeyboardInterrupt

Thanks!

Kind Regards,
Adrian


On Wed, Oct 2, 2013 at 6:38 PM, Adrián <address@hidden> wrote:
Hi,

I'm trying to use the tunnel functionality in Fabric to execute commands on a remote machine through a bastion host. However, right after being prompted for the password it stalls and nothing happens. It's also quite unclear which password you're entering, but that's not an issue because I've set up the same password and user in both boxes for the tests. The code I'm using is pasted below.

from fabric.api import run, env

env.no_keys=True
env.host_string='address@hidden:22'
env.gateway='address@hidden:4242'

run("uname -a")

And the output from running it looks like this:

adrian$ python test-tunnels.py
address@hidden:22] run: uname -a
address@hidden:22] Login password for 'adrian':
address@hidden:22] Login password for 'adrian':

After entering the password twice, it stalls, nothing else happens. If I hit Ctrl-C, this is the stack trace it produces:

^CTraceback (most recent call last):
  File "tunnels.py", line 7, in <module>
    run("uname -a")
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 578, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/fabric/operations.py", line 1042, in run
    shell_escape=shell_escape)
  File "/Library/Python/2.7/site-packages/fabric/operations.py", line 909, in _run_command
    channel=default_channel(), command=wrapped_command, pty=pty,
  File "/Library/Python/2.7/site-packages/fabric/state.py", line 388, in default_channel
    chan = _open_session()
  File "/Library/Python/2.7/site-packages/fabric/state.py", line 380, in _open_session
    return connections[env.host_string].get_transport().open_session()
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 118, in __getitem__
    self.connect(key)
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 110, in connect
    self[key] = connect(user, host, port, sock)
  File "/Library/Python/2.7/site-packages/fabric/network.py", line 392, in connect
    sock=sock
  File "/Library/Python/2.7/site-packages/paramiko/client.py", line 311, in connect
    t.start_client()
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 462, in start_client
    event.wait(0.1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 394, in wait
    self.__cond.wait(timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 257, in wait
    _sleep(delay)
KeyboardInterrupt

I'm sure it's not a SSH problem, since the tunneling command in SSH works. I say more, I was looking online for an answer and I came across this (https://gist.github.com/shnjp/856179), that also works for the same boxes/users. I wonder how that one is different from the built in mechanism into Fabric. I've gone through the documentation and I've not been able to find what I'm doing wrong, so if anyone could shed any light onto this I'd appreciate it very much.

Regards,
Adrian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]