fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Running commands on multiple servers in a command


From: Jeff Forcier
Subject: Re: [Fab-user] Running commands on multiple servers in a command
Date: Wed, 20 May 2009 13:34:17 -0400

On Wed, May 20, 2009 at 1:27 PM, Peter Sheats <address@hidden> wrote:
> I don't think it works...  I tried it briefly and it didn't.  It seems to me
> that the connection is made to the server before the command is run and the
> connection is not closed until the command finishes.
>
> There would have to be a way to close the connection, connect to another
> server, run the command and then do the same again.

Hi Peter,

Did you specify any host lists when trying out that example? I.e. did
you set env.hosts at the top level of your fabfile / specify fab -H
<host> / use a @hosts decorator / specify 'fab mycommand:host=foo' ?
Doing any of those could potentially result in odd behavior if one
modifies env.host_string inside the function, though I think it should
still work OK for the most part (worst should be that your function
runs >1 time if you specified multiple hosts).

Can you be more specific as to how it didn't work?

In terms of connections, what happens is that we keep a simple cache
of connections and then close them all when Fabric finally shuts down.
There shouldn't normally be any need to explicitly
disconnect/reconnect in the middle of a session, at least not in the
scenario we're discussing here.

When run/sudo/etc operate, they ask the cache for a channel to the
server in question, and always get back a handle to the SSH channel --
regardless of whether that channel was just opened or was opened
previously.

Best,
Jeff




reply via email to

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