Reputation: 11677
we have a deploy script that has 5 servers, we want to run the script and notify us only once even though it runs for 5 servers.
The example code:
env.hosts = ['web1', 'web2', 'web3', 'web4', 'web5']
def notify():
sendNotify()
@task
def deploy():
sendNotify()
deploy stuff
deploy stuff
deploy stuff
deploy stuff
I want that notify will be called only once, but because there are 5 servers it is called 5 times.
Upvotes: 1
Views: 337
Reputation: 1564
Maybe you can use the @runs_once
decorator on notify
.
See: http://fabric.readthedocs.org/en/1.3.4/api/core/decorators.html#fabric.decorators.runs_once
Upvotes: 1