Thanks for your reply.
I tried the 2nd option, but both strings are printed for some reason. What am I
missing here? Thanks.
env.hosts = ['app1','app2']
....
def upload_files():
with settings(host_string='app1'):
print 'Uploading files to app1';
with settings(host_string='app2'):
print 'Uploading files to app2';
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jeff
Forcier
Sent: Thursday, October 21, 2010 10:15 AM
To: Yungwei Chen
Cc: [email protected]
Subject: Re: [Fab-user] Uploading different files to different remote hosts
Hi,
Two ways offhand:
@hosts('host1')
def upload1():
put('local', 'remote')
@hosts('host2')
def upload2():
put('local2', 'remote2')
Invoke as "fab upload1 upload2" (calling them from other top level
tasks doesn't currently do what you might expect, due to how @hosts
works).
Another way, which will work when called as a subroutine as well:
def upload_stuff():
with settings(host_string='host1'):
put('local', 'remote')
with settings(host_string='host2'):
put('local2', 'remote2')
HTH,
Jeff
On Thu, Oct 21, 2010 at 11:04 AM, Yungwei Chen <[email protected]> wrote:
> Hi,
>
> I would like to know how to upload different files to different remote hosts
> in the fabfile.
> Thanks.
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org
_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user