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 <[email protected]> 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
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to