From 809fa3996eaf65736e361eb063260430b11eac5e Mon Sep 17 00:00:00 2001 From: Xiaohua Zhang Date: Tue, 18 Sep 2018 08:32:34 +0000 Subject: Implement POST and GET API for infra_workload Change-Id: I7152f2738b0e30075dd0aebb17d74f806dc48b34 Issue-ID: MULTICLOUD-358 Signed-off-by: Xiaohua Zhang --- share/common/msapi/helper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'share/common') diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py index 0c27990b..3ec404eb 100644 --- a/share/common/msapi/helper.py +++ b/share/common/msapi/helper.py @@ -32,10 +32,11 @@ class Helper(object): ret = restcall._call_req(multicloud_api_prefix, "", "", 0, auth_api_url, "POST", extra_headers, json.dumps(data)) if ret[0] > 0 or ret[1] is None: logger.critical("call url %s failed with status %s" % (multicloud_api_prefix+auth_api_url, ret[0])) - return None + return ret resp = json.JSONDecoder().decode(ret[1]) - return resp + ret[1] = resp + return ret # The consumer of this api must be attaching to the same management network of multicloud, # The constraints comes from the returned catalog endpoint url e.g. "http://10.0.14.1:80/api/multicloud-titaniumcloud/v0/pod25_RegionOne/identity/v3" @@ -52,8 +53,9 @@ class Helper(object): ret = restcall._call_req(endpoint_url, "", "", 0, uri, method, extra_headers, json.dumps(data) if data else "") if ret[0] > 0 or ret[1] is None: logger.critical("call url %s failed with status %s" % (endpoint_url+uri, ret[0])) - return None + return ret content = json.JSONDecoder().decode(ret[1]) - return content + ret[1] = content + return ret pass -- cgit 1.2.3-korg