From: xudan Date: Sun, 30 Sep 2018 06:44:07 +0000 (-0400) Subject: Bugfix: There is an exception when crawling Yardstick results X-Git-Tag: ovp-2.1.0~4 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F63067%2F1;p=dovetail.git Bugfix: There is an exception when crawling Yardstick results If there is no pod.yaml, the results data looks like, {"status": 2, "result": "[Errno 2] No such file or directory: u'/home/opnfv/userconfig/pre_config/pod.yaml'"} It will get an exception when reading value from file, File "/usr/local/lib/python2.7/dist-packages/dovetail/report.py", line 327, in crawl_from_file criteria = data['result']['criteria'] TypeError: string indices must be integers https://build.opnfv.org/ci/view/dovetail/job/dovetail-apex-baremetal-default-mandatory-master/52/console Change-Id: I73ca3e5ae73433a2dc139789df4d67e8c583be08 Signed-off-by: xudan (cherry picked from commit 76947950b0196367768068ae31f85ca175b672fb) --- diff --git a/dovetail/report.py b/dovetail/report.py index f1708574..be8d0827 100644 --- a/dovetail/report.py +++ b/dovetail/report.py @@ -324,7 +324,8 @@ class YardstickCrawler(Crawler): for jsonfile in f: data = json.loads(jsonfile) try: - criteria = data['result']['criteria'] + criteria = dt_utils.get_value_from_dict("result.criteria", + data) if criteria == 'PASS': valid_tc = testcase.validate_testcase() details = data['result']['testcases'][valid_tc]