From: Zack Cerza Date: Tue, 24 Mar 2015 23:13:35 +0000 (-0700) Subject: Avoid double-unlocking with unlock_on_failure X-Git-Tag: 1.1.0~982 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=264ff2f43d419c4eaed4c8320cc7b6c7e33e13b9;p=teuthology.git Avoid double-unlocking with unlock_on_failure If both unlock_on_failure and nuke-on-error are set, don't unlock now because we're just going to nuke (and unlock) later. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index f18483783..3d9654bd6 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -163,8 +163,13 @@ def lock_machines(ctx, config): try: yield finally: - if ctx.config.get('unlock_on_failure', False) or \ - get_status(ctx.summary) == 'pass': + # If both unlock_on_failure and nuke-on-error are set, don't unlock now + # because we're just going to nuke (and unlock) later. + unlock_on_failure = ( + ctx.config.get('unlock_on_failure', False) + and not ctx.config.get('nuke-on-error', False) + ) + if get_status(ctx.summary) == 'pass' or unlock_on_failure: log.info('Unlocking machines...') for machine in ctx.config['targets'].iterkeys(): lock.unlock_one(ctx, machine, ctx.owner, ctx.archive)