On Wed, Feb 24, 2010 at 5:52 PM, Steven Samuel Cole
<steven.samuel.c...@gmail.com> wrote:
> It says in the Fabric docs that 'env.hosts is simply a Python list object'.
> From my observations, this is simply not true.

Your observations are incorrect :) env.hosts IS simply a Python list
object. However, the way in which it is used/interpreted is
(regrettably) different from what you expect, and is why you're
confused.

The execution docs page is slightly long, but it should explain most everything:

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

The gist is that env.hosts is only used when running given-on-the-CLI
task names, and not when calling subroutines from inside your tasks.
Instead, run/sudo/etc look at env.host_string when connecting (and
they connect to one and only one host at a time.)

Expect tools to make this easier to appear soon, possibly in the form
of execute('task_name', ['host', 'list', 'here']), and then later on,
possibly in some sort of object-oriented fashion (e.g. task =
MyTaskSubclass() ; task.run(host_list))

For the time being, as long as you mix up a for loop over your desired
host list, and manipulation of env.host_string (either manually or via
'with settings():'), you can get the desired result.

Best,
Jeff


>
> Can anyone explain what is going on here ? How can I set the host to deploy
> to ? I am using Fabric 0.9.
>
>
> _______________________________________________
> Fab-user mailing list
> Fab-user@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org


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

Reply via email to