]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Avoid double-unlocking with unlock_on_failure
authorZack Cerza <zack@redhat.com>
Tue, 24 Mar 2015 23:13:35 +0000 (16:13 -0700)
committerZack Cerza <zack@redhat.com>
Tue, 24 Mar 2015 23:13:35 +0000 (16:13 -0700)
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 <zack@redhat.com>
teuthology/task/internal.py

index f18483783648bff194d7a89264ab96264374740c..3d9654bd6c4450a0a3c5424902ab2cca8445476c 100644 (file)
@@ -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)