[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Fab-user] Uploading different files to different remote hosts
From: |
Yungwei Chen |
Subject: |
RE: [Fab-user] Uploading different files to different remote hosts |
Date: |
Thu, 21 Oct 2010 12:34:04 -0400 |
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: address@hidden [mailto:address@hidden On Behalf Of Jeff Forcier
Sent: Thursday, October 21, 2010 10:15 AM
To: Yungwei Chen
Cc: address@hidden
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 <address@hidden> wrote:
> Hi,
>
> I would like to know how to upload different files to different remote hosts
> in the fabfile.
> Thanks.
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org