fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Creating a tunnel with Fabric


From: Jeff Forcier
Subject: Re: [Fab-user] Creating a tunnel with Fabric
Date: Mon, 2 Nov 2009 09:09:59 -0500

> On Mon, Nov 2, 2009 at 5:32 AM, Taras Mankovski <address@hidden> wrote:

>> What do you think about creating a function in Fabric that would allow
>> easy setup of a tunnel through ssh?

I think it's a fantastic idea. I'm always wary of gotchas but unless
some pop up, it seems useful and doable.

On Mon, Nov 2, 2009 at 4:39 AM, Christian Vest Hansen
<address@hidden> wrote:

> Unfortunately, I can't comment on whether the fabric context managers
> in their current incarnation are powerful enough to do this.

Well, they're all independent of each other, so this would simply be
writing a new one, there's no context manager framework or anything
like that. Should be as simple as (going from memory here)::

    @contextmanager
    def tunnel(local_port, remote_port):
        conn = state.connections[env.host_string]
        conn.make_a_tunnel_however_paramikos_api_lets_us(local_port,
remote_port)
        yield
        conn.close_the_tunnel_lol()

with possibly a tiny bit more management code for sanity's sake, e.g.
a graceful error if the user accidentally nests two of these with an
overlap in the port numbers.

Taras, if you have time, please make a Redmine ticket for this,
including the examples from your email. Otherwise I'll take care of it
sometime soon. (The ticket, that is; unsure where in the priority
queue the actual work should go, but it won't be #1 unfortunately ;)
but it does get Interesting Problem To Solve and Might Be A Nice Quick
Addition points...)

Thanks,
Jeff




reply via email to

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