[Top][All Lists]

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

Re: [Fab-user] grouping tasks

From: Jiri Barton
Subject: Re: [Fab-user] grouping tasks
Date: Wed, 03 Feb 2010 10:53:40 +0100
User-agent: Thunderbird (X11/20090817)

I don't know if I'm doing something wrong but it would not work for me.
Consider this fabfile.py:

from fabric.api import *

def deploy_one():
    run('this on 1')

def deploy_two():
    run('that on 2')

def deploy():

Well, if I run ``fab deploy`` it will complain about missing host
definition for the task ``deploy``:

$ fab deploy
No hosts found. Please specify (single) host string for connection:

I have looked all over the web only to find everyone would be running
``fab deploy_one deploy_two``. Which is not what I want.

How can I make the script work?

Christian Vest Hansen wrote:
> Tasks are just python functions. You can create a task `deploy` like
> this, for instance:
> def deploy():
>   deploy_db()
>   deploy_app()
>   deploy_daemons()
>   deploy_queue()
> On Fri, Jan 29, 2010 at 3:54 PM, Jiri Barton <address@hidden> wrote:
>> Hi,
>> I was wondering if there is a way to group tasks and then refer to the
>> group by one name. I don't want to start but sort of what namespaces in
>> Capistrano could be used for.
>> What I'm trying to do is to deploy to several machines which are domain
>> specific. I have a database machine, a web server with the application
>> code, a machine which runs daemons, and a machine for command queuing.
>> Of course, each machine has specific needs and it would be more fitting
>> if I defined different fabric tasks for each of them, like:
>> def deploy_db():
>>    #migrate the db schema
>> def deploy_app():
>>    #restart web server
>> def deploy_daemons():
>>    #restart all app daemons
>> def deploy_queue():
>>    #restart the queuing manager
>> Now, what I have to do is
>> fab deploy_db deploy_app deploy_daemons deploy_queue
>> What I had rather do is
>> fab deploy
>> This would call those four tasks from above.
>> The reason for that is the deployment plan - the order in which the
>> deployment tasks are run - hardly ever changes but the order of the
>> tasks is essential. Sometimes I need to restart some services on other
>> machines and so this deployment plan changes.
>> Is there a way?
>> Thanks
>> Jiri
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user

reply via email to

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