Add vfc-vnfmgr traceback log 67/27767/2
authorying.yunlong <ying.yunlong@zte.com.cn>
Wed, 10 Jan 2018 02:09:30 +0000 (10:09 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Wed, 10 Jan 2018 03:02:31 +0000 (11:02 +0800)
Change-Id: If7383218b80eba8b40cb3c10459c2546c3a899c4
Issue-ID: VFC-630
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
mgr/mgr/pub/utils/restcall.py
mgr/mgr/vnfreg/views.py
mgr/tox.ini

index 0a2c59c..e3ce0be 100644 (file)
@@ -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
index 2319db7..23a6398 100644 (file)
@@ -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)
index 4f5c64f..d422bee 100644 (file)
@@ -6,7 +6,7 @@ skipsdist = true
 downloadcache = ~/cache/pip
 
 [flake8]
-ignore =  E501,E722
+ignore =  E501
 max-complexity = 12
 
 [testenv]