Tag Archives: wrapper
June 5, 2012Posted by on
I wrote about Fabric’s error handling in this post and there task execution errors were handled like this:
env.warn_only=True def cmd(cmd): if run(cmd).failed: sudo(cmd)
What if the task is a bit more complex and has multilple parts that can go wrong? You might want to abort the execution and do some kind of rollback action.
The task could be aborted by just using env.warn_only=False but then then the task would be aborted before we can do any rollback actions.
Without a wrapper it could be done like this: