From 76ad7dd92083f7fbe62a224d4baf656e906b7bb6 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Mon, 21 Sep 2009 16:08:19 +0000 Subject: [PATCH] If get_host returns MR_NO_MATCH, check host aliases. Fixes the common case where someone is trying to look up an alias for a deleted host. --- clients/stella/stella.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clients/stella/stella.c b/clients/stella/stella.c index 8245c2c2..7011e430 100644 --- a/clients/stella/stella.c +++ b/clients/stella/stella.c @@ -686,10 +686,21 @@ int main(int argc, char **argv) args[0] = canonicalize_hostname(strdup(hostname)); args[1] = args[2] = args[3] = "*"; status = wrap_mr_query("get_host", 4, args, store_host_info, argv); + + /* We might be looking for an alias of a deleted host. */ + if (status && status == MR_NO_MATCH) { + status = wrap_mr_query("get_hostalias", 2, args, store_host_info, argv); + if (!status) { + args[0] = strdup(argv[1]); + status = wrap_mr_query("get_host", 4, args, store_host_info, argv); + } + } + if (status) { com_err(whoami, status, "while getting host information"); exit(1); } + if (unformatted_flag) show_host_info_unformatted(argv); else -- 2.45.1