summaryrefslogtreecommitdiffstats
path: root/share/common/msapi/helper.py
diff options
context:
space:
mode:
authorXiaohua Zhang <xiaohua.zhang@windriver.com>2018-09-18 08:32:34 +0000
committerXiaohua Zhang <xiaohua.zhang@windriver.com>2018-09-18 10:30:06 +0000
commit809fa3996eaf65736e361eb063260430b11eac5e (patch)
tree3a3de0affb71f6b6162c7517ec36867f135f59cc /share/common/msapi/helper.py
parent5a925b04bee358d573e0f49caa37690399c32204 (diff)
Implement POST and GET API for infra_workload
Change-Id: I7152f2738b0e30075dd0aebb17d74f806dc48b34 Issue-ID: MULTICLOUD-358 Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'share/common/msapi/helper.py')
-rw-r--r--share/common/msapi/helper.py10
1 files changed, 6 insertions, 4 deletions
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