fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] env.hosts


From: Christian Vest Hansen
Subject: Re: [Fab-user] env.hosts
Date: Mon, 30 Aug 2010 14:58:33 +0200

Fabric takes the env.hosts variable is taken into consideration just
prior to executing a task. So, if you move your env.hosts assignment
to another task and execute that before you execute "doit" then it
will work:

def setup():
  env.user = "keyes"
  env.hosts = ['example.com']

def doit():
  run('ls')

What fabric does, among other things, is that it wraps your task in a
loop that sets env.host_string to each of the hosts in turn. Or
something with a similar effect. And then runs the task for each host.

On Mon, Aug 30, 2010 at 13:43, John Keyes <address@hidden> wrote:
> I ran the following command using Fabric 0.9.1:
>
>    def doit():
>        env.user = 'keyes'
>        env.hosts = ['example.com']
>        run('ls')
>
> and got the following output:
>
>    No hosts found. Please specify (single) host string for connection:
>
> I changed the command to:
>
>    def doit():
>        env.user = 'keyes'
>        env.host_string = 'example.com'
>        run('ls')
>
> and the directory listing was printed to the console.
>
> The documentation always refers to the env.hosts setting but I cannot
> get that to work. Have I missed something?
>
> Thanks,
> -John
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.



reply via email to

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