fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Sticking more stuff into env from the commandline


From: Christian Vest Hansen
Subject: Re: [Fab-user] Sticking more stuff into env from the commandline
Date: Wed, 5 Oct 2011 15:47:59 +0200

If the variables are not very varying, you can put them in a config file that you load with the -c argument: http://docs.fabfile.org/en/1.2.2/usage/fab.html#command-line-options

Otherwise a `let` command (a generalized form of Simons suggestion) is fairly easy to write:

@Task
def let(**args):
env.update(args)

Note that the above code is reproduced from memory and that I have not been able to test it.
The idea is that the updates to `env` performed by this command are used by other commands that execute later in the flow:

$ fab let:a=b do-something-with-a

I hope this helps.

On Wed, Oct 5, 2011 at 15:02, Oivvio Polite <address@hidden> wrote:
On Wed, Oct 05, 2011 at 11:00:16PM +1100, Simon KP wrote:
> You could set env variables from passing an argument to fabric function from
> command line,
>
> $ fab sometask:foo,baz,keyword=kwbar
>
> sometask(first, second, keyword='')
>     env.first = first
>     env.second = second
>     env.keywork = keyword

And if I have a whole bunch of tasks that depend on the same env
variables being present do I then need to duplicate this for every task
definition?

oivvio

--
http://liberationtech.net

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user



--
Venlig hilsen / Kind regards,
Christian Vest Hansen.

reply via email to

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