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 = "x...@google.com" inside deploy() above
the call to rdeploy(). Then any run() or sudo() or put(), etc etc,
calls inside rdeploy() would connect to "x...@google.com" 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 <anuraguni...@yahoo.com> 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('x...@www.google.com')
> def rdeploy():
>     run('pwd')
>
> def deploy():
>     rdeploy()
>
>
> now if i use
> $ fab rdeploy -f del.py
> [...@www.google.com] 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
> Fab-user@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
>


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

Reply via email to