summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-01-10 10:09:30 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-01-10 11:02:31 +0800
commit2e9f7959754714c93ede756766658f1cd8f23894 (patch)
tree680a57b03099eb3ffb6e2dadcbc523386f59188b
parente48c3155c40d1bab7a6413eb86359245a1f45470 (diff)
Add vfc-vnfmgr traceback log
Change-Id: If7383218b80eba8b40cb3c10459c2546c3a899c4 Issue-ID: VFC-630 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--mgr/mgr/pub/utils/restcall.py3
-rw-r--r--mgr/mgr/vnfreg/views.py5
-rw-r--r--mgr/tox.ini2
3 files changed, 5 insertions, 5 deletions
diff --git a/mgr/mgr/pub/utils/restcall.py b/mgr/mgr/pub/utils/restcall.py
index 0a2c59c..e3ce0be 100644
--- a/mgr/mgr/pub/utils/restcall.py
+++ b/mgr/mgr/pub/utils/restcall.py
@@ -69,9 +69,6 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''):
if 'httplib.ResponseNotReady' in res_info:
res_info = "The URL[%s] request failed or is not responding." % full_url
ret = [3, res_info, resp_status]
- except:
- logger.error(traceback.format_exc())
- ret = [4, str(sys.exc_info()), resp_status]
logger.debug("[%s]ret=%s" % (callid, str(ret)))
return ret
diff --git a/mgr/mgr/vnfreg/views.py b/mgr/mgr/vnfreg/views.py
index 2319db7..23a6398 100644
--- a/mgr/mgr/vnfreg/views.py
+++ b/mgr/mgr/vnfreg/views.py
@@ -14,6 +14,7 @@
import logging
import json
+import traceback
from rest_framework import status
from rest_framework.decorators import api_view
@@ -42,6 +43,7 @@ def add_vnf(request, *args, **kwargs):
password=ignore_case_get(request.data, "password")).save()
except Exception as e:
logger.error(e.message)
+ logger.error(traceback.format_exc())
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data={"vnfInstId": vnf_inst_id}, status=status.HTTP_201_CREATED)
@@ -51,7 +53,6 @@ def access_vnf(request, *args, **kwargs):
vnf_inst_id = ignore_case_get(kwargs, "vnfInstId")
logger.info("Enter %s, method is %s, ", fun_name(), request.method)
logger.info("vnfInstId is %s, data is %s", vnf_inst_id, request.data)
- # ret, normal_status = None, None
try:
vnf = VnfRegModel.objects.filter(id=vnf_inst_id)
if not vnf:
@@ -88,6 +89,7 @@ def access_vnf(request, *args, **kwargs):
normal_status = status.HTTP_204_NO_CONTENT
except Exception as e:
logger.error(e.message)
+ logger.error(traceback.format_exc())
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data=ret, status=normal_status)
@@ -112,5 +114,6 @@ def vnf_config(request, *args, **kwargs):
raise Exception("Failed to config Vnf(%s): %s" % (vnf_inst_id, ret[1]))
except Exception as e:
logger.error(e.message)
+ logger.error(traceback.format_exc())
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data={}, status=status.HTTP_202_ACCEPTED)
diff --git a/mgr/tox.ini b/mgr/tox.ini
index 4f5c64f..d422bee 100644
--- a/mgr/tox.ini
+++ b/mgr/tox.ini
@@ -6,7 +6,7 @@ skipsdist = true
downloadcache = ~/cache/pip
[flake8]
-ignore = E501,E722
+ignore = E501
max-complexity = 12
[testenv]