2010/1/12 Jeff Forcier
<address@hidden>
In the lates stable Fab release, you can easily paramaterize your
tasks with task arguments; see:
http://docs.fabfile.org/0.9.0/usage/fab.html#per-task-arguments
So you could pretty easily write a single deploy task that goes
something like this (paraphrasing for the most part, the emphasis is
on the paramaterization):
def deploy(region, databases):
databases = databases.split(';')
put('my files', '/app/%s' % region)
for db in databases:
run('psql -U user %s < /path/to/script.sql' % db)
Fully explicit invocation would look like this:
$ fab deploy:region=europe,databases="db1;db2;db3"
Or you can just use positional args and do this:
$ fab deploy:europe,"db1;db2;db3"
Either one would result in calls such as:
put('my files', '/app/europe')
run('psql -U user db1 < /path/to/script/sql')
run('psql -U user db2 < /path/to/script/sql')
run('psql -U user db3 < /path/to/script/sql')
Hope that helps; let us know if there are additional concerns or if
I've missed your point :)
It *really* helps - I can now dive more into fabric to satisfy my needs :-)
You got the point (at this stage at least, evil is always in details) ;-)
So you may hear from me soon :-)))
Thanks again,
Nicolas