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 <johnke...@gmail.com> 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 > Fab-user@nongnu.org > http://lists.nongnu.org/mailman/listinfo/fab-user > -- Venlig hilsen / Kind regards, Christian Vest Hansen. _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user