On 02/02/11 23:48, Jeff Forcier wrote:
     def deploy():
         execute(update_django_project)
         execute(update_db)
         execute(update_services)

Ew :-P

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.

I wrote @default_role, @default_hosts decorators that supply a host list if there is none, no matter how the function is called. So it is possible to write the straightforward

def deploy():
    update_django_project()
    update_db()
    update_services()

to operate on the appropriate roles so long as you don't call deploy() with any hosts.

There were three use cases for these tasks that needed to work, eg.

1. fab deploy
2. fab update_django_project update_db
3. fab -H web1 update_django_project

In fact my implementation operated on roles and other facts stored in external YAML, as I described here:

http://lists.nongnu.org/archive/html/fab-user/2010-12/msg00020.html

Dan
--
Mauve Internet
t: 01243 888187
w: www.mauveinternet.co.uk

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

Reply via email to