Fix vfc-vnflcm pep8 issues
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / vnfs / views.py
index 2330fa2..cfdf280 100644 (file)
@@ -32,13 +32,14 @@ logger = logging.getLogger(__name__)
 
 class CreateVnfAndQueryVnfs(APIView):
     def get(self, request):
-        logger.debug("QuerySingleVnf--get::> %s" % request.data)
+        logger.debug("QueryMultiVnf--get::> %s" % request.data)
         try:
             resp_data = QueryVnf(request.data).query_multi_vnf()
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except:
+        except Exception as e:
+            logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'Failed to get Vnfs'},
                             status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -51,10 +52,13 @@ class CreateVnfAndQueryVnfs(APIView):
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except Exception:
+        except Exception as e:
+            logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        rsp = {"vnfInstanceId": nf_inst_id}
+        rsp = {
+            "vnfInstanceId": nf_inst_id
+        }
         return Response(data=rsp, status=status.HTTP_201_CREATED)
 
 
@@ -68,10 +72,13 @@ class InstantiateVnf(APIView):
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except Exception:
+        except Exception as e:
+            logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        rsp = {"jobId": job_id}
+        rsp = {
+            "jobId": job_id
+        }
         return Response(data=rsp, status=status.HTTP_202_ACCEPTED)
 
 
@@ -83,7 +90,8 @@ class DeleteVnfAndQueryVnf(APIView):
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except:
+        except Exception as e:
+            logger.eror(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'Failed to get Vnf(%s)' % instanceid},
                             status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -96,7 +104,8 @@ class DeleteVnfAndQueryVnf(APIView):
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except Exception:
+        except Exception as e:
+            logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
         return Response(data=None, status=status.HTTP_204_NO_CONTENT)
@@ -112,8 +121,11 @@ class TerminateVnf(APIView):
         except NFLCMException as e:
             logger.error(e.message)
             return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        except Exception:
+        except Exception as e:
+            logger.error(e.message)
             logger.error(traceback.format_exc())
             return Response(data={'error': 'unexpected exception'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-        rsp = {"jobId": job_id}
+        rsp = {
+            "jobId": job_id
+        }
         return Response(data=rsp, status=status.HTTP_202_ACCEPTED)