fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Uploading different files to different remote hosts


From: Jeff Forcier
Subject: Re: [Fab-user] Uploading different files to different remote hosts
Date: Thu, 21 Oct 2010 14:25:30 -0400

The host_string setting is what determines what host run(), sudo() etc
connect to when they execute. It's not a "when running on host X" or
anything like that.

You should read the execution docs to get a better idea of how all
this is put together:

    http://docs.fabfile.org/0.9.2/usage/execution.html

Best,
Jeff

On Thu, Oct 21, 2010 at 12:34 PM, Yungwei Chen <address@hidden> wrote:
> 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
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org



reply via email to

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