aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/decorators.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-04-19 02:21:14 -0400
committerCédric Ollivier <cedric.ollivier@orange.com>2017-04-19 10:53:10 +0200
commit7e15dbb5136b1b298d86a82c03199bf1f7a6fe46 (patch)
treed6702d643c5ccc2f781ca8fc023bea42b9bf73e4 /functest/utils/decorators.py
parent6dbdeb1edc2d92be2c55a1b0dfdcf1fffc05c0a7 (diff)
Stop hardcoding results suffix in push_to_db
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 <cedric.ollivier@orange.com> Change-Id: I35ba9b34d99e138292f099934e28585ee8b85604 Signed-off-by: MatthewLi <matthew.lijun@huawei.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/utils/decorators.py')
-rw-r--r--functest/utils/decorators.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 276235d9..2ca31066 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"