fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Can Fabric have (simple) multi-server wrapper tasks?


From: Daniel Pope
Subject: Re: [Fab-user] Can Fabric have (simple) multi-server wrapper tasks?
Date: Thu, 03 Feb 2011 09:37:26 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4

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



reply via email to

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