[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] Executing a block of code once for task that has multiple hos
From: |
Ahsan Rabbani |
Subject: |
[Fab-user] Executing a block of code once for task that has multiple hosts |
Date: |
Wed, 5 Oct 2011 16:43:25 -0400 |
Is it possible to have certain code executed only once even if a task has multiple hosts defined (without having to invoke multiple tasks from the command line)? For example, if I had a compile step that only needs to be done once and then the rsyncing of the files would be executed for each host. I tried doing something like the following but it doesn't work and fails to recognize the hosts when rsync_files is called from within the compile task.
def compile(*projects):
for projects in projects:
# compile project
rsync_files(*projects)
@hosts("host1", "host2", "host3")
def rsync_files(projects):
# rsync compiled files to each host
- [Fab-user] Executing a block of code once for task that has multiple hosts,
Ahsan Rabbani <=