fabpreso/context_managers.py

19 lines
333 B
Python
Raw Normal View History

2013-01-24 18:47:02 -08:00
from fabric.api import env, run, cd, settings, local
env.roledefs = {
'web': ['web1', 'web2', 'web3'],
'db': ['db1', 'db2']
}
2013-01-24 19:03:49 -08:00
2013-01-24 18:47:02 -08:00
def cd_example():
with cd('/tmp'):
run('pwd')
def push_anyway():
with settings(warn_only=True):
# simulate failure
local('false')
run('echo doing it anyway')