fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] why fabscript asks for host?


From: Jeff Forcier
Subject: Re: [Fab-user] why fabscript asks for host?
Date: Sun, 8 Nov 2009 09:03:53 -0500

Hi Anurag,

Please check out the docs on how Fabric executes your tasks:

    http://docs.fabfile.org/0.9/usage/execution.html

The key here is that right now, only the @hosts decorators for the
task actually called on the command line will take effect -- not
subtasks.

If you can provide more details I could give you a better idea of how
to work around this for the time being.

For example, if your example is almost literally how your code looks,
you could set env.host_string = "address@hidden" inside deploy() above
the call to rdeploy(). Then any run() or sudo() or put(), etc etc,
calls inside rdeploy() would connect to "address@hidden" as you
intended.

If your @hosts line sets >1 host, you could simply wrap the rdeploy()
call in a loop which does the same thing (sets env.host_string, calls
rdeploy().)

Also note that this behavior is highly likely to be upgraded in the
future to become more flexible:

    http://code.fabfile.org/issues/show/21

Best,
Jeff



On Sun, Nov 8, 2009 at 1:37 AM, anurag uniyal <address@hidden> wrote:
> Hi,
>
> I have simplified my installation script to for demonstration, see below
>
> from fabric.api import run, env
> from fabric.decorators import hosts
>
> @hosts('address@hidden')
> def rdeploy():
>     run('pwd')
>
> def deploy():
>     rdeploy()
>
>
> now if i use
> $ fab rdeploy -f del.py
> address@hidden run: pwd
>
> it works as expected, because for rdeploy host has been set
>
> but if i call deploy,
> $ fab deploy -f del.py
> No hosts found. Please specify (single) host string for connection:
>
> it asks for host, which is not useful as deploy do not use any remote
> commands
> and only remote command we use has hosts already set
>
>
> rgds
> Anurag
>
> ________________________________
> Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
> _______________________________________________
> 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]