From 2b6a442b46622aaa8c4863d923ba5d68a424230e Mon Sep 17 00:00:00 2001 From: "Cel A. Skeggs" Date: Thu, 25 Jan 2018 14:45:39 -0500 Subject: [PATCH] Improve prometheus-based verification reporting --- building/build-debs/homeworld-admin-tools/src/verify.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/building/build-debs/homeworld-admin-tools/src/verify.py b/building/build-debs/homeworld-admin-tools/src/verify.py index f981f57ba..f313d97aa 100644 --- a/building/build-debs/homeworld-admin-tools/src/verify.py +++ b/building/build-debs/homeworld-admin-tools/src/verify.py @@ -46,8 +46,10 @@ def pull_prometheus_query(query): if data.get("resultType") != "vector": command.fail("prometheus query did not produce a vector") result_vec = data["result"] - if type(result_vec) != list or len(result_vec) != 1: + if type(result_vec) != list or len(result_vec) > 1: command.fail("prometheus query returned %d results instead of 1" % len(result_vec)) + if not result_vec: + command.fail("no results from prometheus query '%s'" % query) if type(result_vec[0]) != dict or "value" not in result_vec[0] or len(result_vec[0]["value"]) != 2: command.fail("unexpected format of result") return result_vec[0]["value"][1]