From: SerenaFeng Date: Mon, 22 Aug 2016 02:50:31 +0000 (+0800) Subject: bugfix: push_result_to_db exception show X-Git-Tag: colorado.1.0~110^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F19137%2F4;p=functest.git bugfix: push_result_to_db exception show When pod is not exist in DB, exception will be shown as 'Error pushing results into Database ''', very unclear, make it very difficult to fix the problem. Modify it to show as the testapi returned 'HTTPError: HTTP 404: Not Found (Could not find pod [zte-no])' JIRA: FUNCTEST-424 Change-Id: I55fc4639d745b84f6d32a148bd13793d236e2a09 Signed-off-by: SerenaFeng --- diff --git a/utils/functest_utils.py b/utils/functest_utils.py index b83309e3a..807a671a3 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -221,6 +221,11 @@ def push_results_to_db(project, case_name, logger, logger.debug(r) r.raise_for_status() return True + except requests.RequestException: + if logger: + logger.error("Pushing Result to DB(%s) failed: %s" % + (r.url, r.content)) + return False except Exception, e: print("Error [push_results_to_db('%s', '%s', '%s', '%s'," "'%s', '%s', '%s', '%s', '%s')]:" %