summaryrefslogtreecommitdiffstats
path: root/share/common/utils/restcall.py
diff options
context:
space:
mode:
authorXiaohua Zhang <xiaohua.zhang@windriver.com>2019-04-10 08:51:19 +0000
committerXiaohua Zhang <xiaohua.zhang@windriver.com>2019-04-10 09:48:26 +0000
commit2024bb59b1d4ec20300304aed3a69132b9c082bc (patch)
tree349a90cd5fc0c64335142c09bd76db86e3d2d7e7 /share/common/utils/restcall.py
parent14132a2c06bc6b6431f5be90cecf303132d94103 (diff)
Fix bug of AZ cap check
Fix bugs in restcall module update the status code of workload api Remove unused event api from lenovo Change-Id: Iaa16bc3aca42c4583408384c73802ff4debe1b19 Issue-ID: MULTICLOUD-542 Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'share/common/utils/restcall.py')
-rw-r--r--share/common/utils/restcall.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/share/common/utils/restcall.py b/share/common/utils/restcall.py
index eb4cb008..464dd65f 100644
--- a/share/common/utils/restcall.py
+++ b/share/common/utils/restcall.py
@@ -65,9 +65,10 @@ def _call_req(base_url, user, passwd, auth_type,
headers['Authorization'] = 'Basic ' + \
base64.b64encode(tmpauthsource).decode('utf-8')
- logger.info("Making rest call with uri,method, header = %s, %s, %s" % (full_url, method.upper(), headers))
+ logger.info("Making rest call with method, uri, header = %s, %s, %s" %
+ (method.upper(), full_url, headers))
if content:
- logger.debug("with content = %s" % (content))
+ logger.debug("with content = %s" % content)
ca_certs = None
for retry_times in range(MAX_RETRY_TIME):
@@ -138,8 +139,9 @@ def req_to_aai(resource, method, content='', appid=settings.MULTICLOUD_APP_ID, n
# hook to flush cache
if method.upper() in ["PUT", "POST", "PATCH", "DELETE"]:
aai_cache.flush_cache_by_url(resource)
- elif method.upper in ["GET"] and not nocache:
+ elif method.upper() in ["GET"] and not nocache:
content = aai_cache.get_cache_by_url(resource)
+ # logger.debug("cached resource: %s, %s" % (resource, content))
if content:
return content
@@ -148,7 +150,8 @@ def req_to_aai(resource, method, content='', appid=settings.MULTICLOUD_APP_ID, n
resource, method, content=json.dumps(content), extra_headers=headers)
if method.upper() in ["GET"] and ret == 0 and not nocache:
- aai_cache.set_cache_by_url(resource, [ret, resp_body, resp_status])
+ # aai_cache.set_cache_by_url(resource, [ret, resp_body, resp_status])
+ aai_cache.set_cache_by_url(resource, (ret, resp_body, resp_status))
return [ret, resp_body, resp_status]