From 264ff2f43d419c4eaed4c8320cc7b6c7e33e13b9 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 24 Mar 2015 16:13:35 -0700 Subject: [PATCH] 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 --- teuthology/task/internal.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index f184837836..3d9654bd6c 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) -- 2.39.5