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

Reply via email to