I wasn't saying you had duplicates, but fabric uses the set type to remove duplicates in host lists. It does this when it combines hosts and roles on a function to run, so there isn't a guarantee of order for hosts.
Here's where that is happening http://github.com/bitprophet/fabric/blob/put-get-overhaul/fabric/main.py#L364 And if you're unfamiliar with set: http://docs.python.org/tutorial/datastructures.html#sets now to get your hosts to run in a specific order is going to be tougher. I think you'd need to split the body of the task into another function foo and do something like this: def putfile(): for host in env.hosts: env.host = env,hoststring = host foo() But I haven't tried that, so i might be wrong. goose On Thu, Oct 14, 2010 at 09:43:51AM -0400, Jeff Honey wrote: > <snip> > from fabric.api import * > > env.hosts = ['foo1.com', 'foo2.com', 'foo3.com', 'foo4.com', 'foo5.com', > 'foo6.com'] > > def putfile(): > put(r'c:\blah.txt', '/tmp/') > run('touch /tmp/blah.txt') > </snip> > > I checked and double-checked that there were no dupes in my list. Previously > it was using this: > > <snip> > from fabric.api import * > > env.roledefs = { > 'servers': ['foo1.com', 'foo2.com', 'foo3.com', 'foo4.com', 'foo5.com', > 'foo6.com'], > } > > @roles('servers') > def putfile(): > put(r'c:\blah.txt', '/tmp/') > run('touch /tmp/blah.txt') > </snip> > > ...the behaviour I was expecting was for the function 'pufile()' to happen on > foo1.com first and then go through the rest of the list in order. > -- > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > ¤ kyoboku kazeoshi ¤ > ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ > ________________________________________ > From: Morgan Goose [[email protected]] > Sent: Thursday, October 14, 2010 9:26 > To: Jeff Honey > Subject: Re: [Fab-user] order control > > If I recall the hosts all get sent through a set() conversion to remove > duplicates, that would make the order undefined. Do you have an example > fabfile > we can look at? > _______________________________________________ > Fab-user mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/fab-user ---end quoted text--- _______________________________________________ Fab-user mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/fab-user
