aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-03-17 14:28:38 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2020-03-17 18:06:09 +0100
commit88beba1cdba8fd44874528489c03ae9805ae0cf9 (patch)
tree46a8de392022232c4d035f88dadd08fc449be311
parente2d3d12e4061c414e8cfda55fb2285243188a264 (diff)
Post-processed data from DB
It removes base_url to match the location in archive. It forces a relative path by removing first "/". It makes sense but it may raise side effects in dovetail webportal. Change-Id: Idca69a99fed54ddf69334a865bae15b0a08220fc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 0ef9c196b42b8c9182710b0f937f775199b0feea)
-rw-r--r--xtesting/core/campaign.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/xtesting/core/campaign.py b/xtesting/core/campaign.py
index 60af3f46..7c766e53 100644
--- a/xtesting/core/campaign.py
+++ b/xtesting/core/campaign.py
@@ -71,9 +71,17 @@ class Campaign():
"{}?build_tag={}".format(url, env.get('BUILD_TAG')),
headers=testcase.TestCase.headers)
req.raise_for_status()
- Campaign.__logger.debug("data from DB: \n%s", req.json())
+ output = req.json()
+ Campaign.__logger.debug("data from DB: \n%s", output)
+ for i, _ in enumerate(output["results"]):
+ for j, _ in enumerate(
+ output["results"][i]["details"]["links"]):
+ output["results"][i]["details"]["links"][j] = re.sub(
+ "^{}/*".format(os.environ["HTTP_DST_URL"]), '',
+ output["results"][i]["details"]["links"][j])
+ Campaign.__logger.debug("data to archive: \n%s", output)
with open("{}.json".format(env.get('BUILD_TAG')), "w") as dfile:
- json.dump(req.json(), dfile)
+ json.dump(output, dfile)
except Exception: # pylint: disable=broad-except
Campaign.__logger.exception(
"The results cannot be collected from DB")