When testing new tasks, it's a drag to have to keep manually unlocking
the targets. Default behavior is to keep them locked for any failure;
this allows overriding that choice for the case where the failure is
in debugging the task, where the state of the targets isn't important.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
try:
yield
finally:
- if ctx.summary.get('success', False):
+ if ctx.config.get('unlock_on_failure', False) or \
+ ctx.summary.get('success', False):
log.info('Unlocking machines...')
for machine in ctx.config['targets'].iterkeys():
lock.unlock_one(ctx, machine, ctx.owner)