[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Can Fabric have (simple) multi-server wrapper tasks?
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] Can Fabric have (simple) multi-server wrapper tasks? |
Date: |
Wed, 2 Feb 2011 18:48:06 -0500 |
> What I'd love, and I suspect Carlton would as well, is the ability to wrap
> all those up in a single function
>
> def deploy():
> update_django_project()
> update_db()
> update_services()
>
> And thus be able to deploy with one line
>
> $ fab production deploy
This is a known "issue", and right now the plan is to hopefully
address it in 1.1 or 1.2 by wrapping up the execution bits in 'fab',
making them slightly smarter/cleaner, and exposing them to the user as
a function:
http://code.fabfile.org/issues/show/21
Thus, your above code would turn into something like this (the name of
the function used is still up in the air):
def deploy():
execute(update_django_project)
execute(update_db)
execute(update_services)
Or, of course, even this:
def deploy:
for subtask in (update_django_project, update_db, update_services):
execute(subtask)
(Or maybe even allowing the first argument of execute() to be an
iterable of callables.)
Point being that in order to get the extra "magic" of honoring
host/role decorators, we'd need to ask users to move from calling
subtasks directly, to passing them into some new API function call.
Not quite as simple, but much more powerful.
-Jeff
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org