From 37e176bf6a3b0d90311a4822ee4efa18e4756cbb Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 10 Apr 2015 10:30:53 -0600 Subject: [PATCH] Always call unlock_one() with the user arg I'd seen a few cases where vps creation would fail, and then unlocking failed because we were incorrectly guessing the owner of the lock. Signed-off-by: Zack Cerza --- teuthology/lock.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/teuthology/lock.py b/teuthology/lock.py index 4aa220020a..1eafbd6105 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -281,8 +281,8 @@ def main(ctx): ) if len(result) < ctx.num_to_lock: log.error("Locking failed.") - for machn in result: - unlock_one(ctx, machn) + for machine in result: + unlock_one(ctx, machine, user) ret = 1 else: log.info("Successfully Locked:\n%s\n" % shortnames) @@ -371,7 +371,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None, else: log.error('Unable to create virtual machine: %s', machine) - unlock_one(ctx, machine) + unlock_one(ctx, machine, user) return ok_machs return machines elif response.status_code == 503: @@ -426,9 +426,7 @@ def unlock_many(names, user): return response.ok -def unlock_one(ctx, name, user=None, description=None): - if user is None: - user = misc.get_user() +def unlock_one(ctx, name, user, description=None): name = misc.canonicalize_hostname(name, user=None) if not provision.destroy_if_vm(ctx, name, user, description): log.error('downburst destroy failed for %s', name) -- 2.39.5