[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Running commands on multiple servers in a command
From: |
Jorge Vargas |
Subject: |
Re: [Fab-user] Running commands on multiple servers in a command |
Date: |
Wed, 20 May 2009 19:06:17 -0400 |
On Wed, May 20, 2009 at 1:29 PM, Jeff Forcier <address@hidden> wrote:
> On Wed, May 20, 2009 at 1:06 PM, Jorge Vargas <address@hidden> wrote:
>
>> Awesome recipe it should be documented on sphinx? I wanted to switch
>> host at runtime too.
>
> Hi Jorge,
>
> Well, it's not documented yet because that's not what I want the final API to
> look like. As of right now, in fact, one could use the new (but documented, I
> think) ``settings`` context manager, i.e.::
>
> with settings(host_string='server1'):
> value = run('foo')
> with settings(host_string='server2'):
> run('bar %s' % value)
>
this works like a charm. maybe switching hosts is a common enough task
to have it's own context?
with host('server1'):
value = run('foo')
and host will call settings?
> $ fab deployA deployB
>
> Again, though, I want to think this sort of thing through more before I
> declare
> any best practices. For example, you can't (currently) call the above
> deployA/deployB functions from another function, because of the way @hosts and
> friends work right now (they set an attribute on the function which is only
> read if the function is invoked directly via ``fab <function name>``.)
I don't like this idea because it means someone can run fab deployA
which means you will leave your system on a half updated state. So the
first form is more "transactional"
>
> At any rate, my older example, and the first example in this email, should
> both
> work OK as-is. Chances are that any updates to the execution model (as in the
> previous paragraph) will occur between the 0.9 final release, and 1.0.
>
> Best,
> Jeff
>