fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Maybe my fabfile callables should get called with a para


From: Jeff Forcier
Subject: Re: [Fab-user] Maybe my fabfile callables should get called with a parameter
Date: Tue, 7 Jul 2009 16:15:23 -0400

Check out the value of env.host. It's updated dynamically to be the
current host every time. No need to pass anything in, you just need to
make sure you import the 'env' object from fabric.api (it's included
if you do 'from fabric.api import *', PEP8 compliance
notwithstanding.)

Better yet, do some printing of env itself, you'll see the various
things that get stored and changed during execution.

This will all be explicitly documented before the beta is over :)

-Jeff

On Tue, Jul 7, 2009 at 4:04 PM, Matthew Wilson<address@hidden> wrote:
> I'm daydreaming here, but I can see a scenario where I want to do one
> thing on one box, and something slightly different on another box,
> e.g.:
>
> @hosts('a.example.com')
> def foo():
>    run('touch a.example.com')
>
> @hosts('b.example.com')
> def bar():
>    run('touch b.example.com')
>
> It would be neat if I could use the host currently being connected to
> as a variable in my callable, like:
>
> @hosts('a.example.com', 'b.example.com')
> def baz(local_env):
>    hostname = localenv['host']
>    run('touch %s' % hostname)
>
> Maybe this is already possible.
>
> Matt
>
>
> --
> Matthew Wilson
> address@hidden
> http://tplus1.com
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>




reply via email to

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