diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-03-17 14:28:38 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-03-17 14:34:12 +0100 |
commit | 0ef9c196b42b8c9182710b0f937f775199b0feea (patch) | |
tree | 16cac67e203188ed996036490ca3be40edfac1de /xtesting/core | |
parent | a5f39b0edfcdcc70cc59f2433bc593595bad9266 (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>
Diffstat (limited to 'xtesting/core')
-rw-r--r-- | xtesting/core/campaign.py | 12 |
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") |