From 4af24ab61703bca05a37c062388390ac82d5c96e Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Wed, 19 Apr 2017 02:21:14 -0400 Subject: Stop hardcoding results suffix in push_to_db MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding results in url is useless as it is defined in results section in config_functest.yaml. It allows defining the full name in case of dumping to file (see decorator.py). The commented local file is the value required by dovetail. Co-Authored-By: Cédric Ollivier Change-Id: I35ba9b34d99e138292f099934e28585ee8b85604 Signed-off-by: MatthewLi Signed-off-by: Cédric Ollivier (cherry picked from commit 7e15dbb5136b1b298d86a82c03199bf1f7a6fe46) --- functest/utils/decorators.py | 5 +++-- functest/utils/functest_utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'functest/utils') diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py index 276235d96..2ca31066d 100644 --- a/functest/utils/decorators.py +++ b/functest/utils/decorators.py @@ -13,11 +13,12 @@ def can_dump_request_to_file(method): parseresult = urlparse.urlparse(request.url) if parseresult.scheme == "file": try: - os.makedirs(parseresult.path) + dirname = os.path.dirname(parseresult.path) + os.makedirs(dirname) except OSError as e: if e.errno != errno.EEXIST: raise - with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f: + with open(parseresult.path, 'a') as f: headers = "" for key in request.headers: headers += key + " " + request.headers[key] + "\n" diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 7cc5029d9..48682718d 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -197,7 +197,7 @@ def push_results_to_db(project, case_name, POST results to the Result target DB """ # Retrieve params from CI and conf - url = get_db_url() + "/results" + url = get_db_url() try: installer = os.environ['INSTALLER_TYPE'] -- cgit 1.2.3-korg