From 7a14a93d917c1ab8b8d2d2797735a418ea904561 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 5 Aug 2013 18:48:27 -0500 Subject: [PATCH] Add a useful error message in case of an invalid hostname --- teuthology/lock.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/teuthology/lock.py b/teuthology/lock.py index 65d1fcf796211..e98444e763243 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -281,7 +281,14 @@ Lock, unlock, or query lock status of machines. assert ctx.desc is None, '--desc does nothing with --list' if machines: - statuses = [ls.get_status(ctx, machine) for machine in machines] + statuses = [] + for machine in machines: + status = ls.get_status(ctx, machine) + if status: + statuses.append(status) + else: + log.error("Lockserver doesn't know about machine: %s" % + machine) else: statuses = list_locks(ctx) vmachines = [] @@ -445,7 +452,7 @@ to run on, or use -a to check all of them automatically. machines.append(t) except IOError, e: raise argparse.ArgumentTypeError(str(e)) - + return scan_for_locks(ctx, machines) def keyscan_check(ctx, machines): @@ -485,7 +492,7 @@ def update_keys(ctx, out, current_locks): log.error('failed to update %s!', full_name) ret = 1 return ret - + def scan_for_locks(ctx, machines): out, current_locks = keyscan_check(ctx, machines) return update_keys(ctx, out, current_locks) -- 2.39.5