From 536a69f1f4da37ebb395a6f6d5eabfeb50503202 Mon Sep 17 00:00:00 2001 From: Peter Razumovsky Date: Thu, 25 Oct 2018 19:58:39 +0400 Subject: [PATCH] Fix missing "is None" for check_metrics in grafana One condition misses "is None" and so raises KeyError, so fix this place. Change-Id: Idf28fef97a261c12792b65cb1c5624368d3f8646 --- rally_openstack/services/grafana/grafana.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rally_openstack/services/grafana/grafana.py b/rally_openstack/services/grafana/grafana.py index eb5b7664..aa0edba1 100644 --- a/rally_openstack/services/grafana/grafana.py +++ b/rally_openstack/services/grafana/grafana.py @@ -60,11 +60,12 @@ class GrafanaService(service.Service): self._spec["grafana"]["password"])) result = resp.json() LOG.debug("Grafana response code: %s" % resp.status_code) - is_result = result.get("data") or len(result["data"]["result"]) < 1 - if is_result and i + 1 >= retries_total: + no_result = (result.get("data") is None or + len(result["data"]["result"]) < 1) + if no_result and i + 1 >= retries_total: LOG.debug("No instance metrics found in Grafana") return False - elif is_result: + elif no_result: i += 1 commonutils.interruptable_sleep(sleep_time) else: