summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-12-20 09:49:44 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-12-20 09:49:44 +0800
commit0316a14318b0d8710f54c4a521932c3a56118931 (patch)
tree5c544d55fec98c7927eee62e218a9e4428506233
parent19ad5b4b6daff5e6e7da9cf815d1750d5a8be6e6 (diff)
Fix vfc-vnfres excaption pep8amsterdam
Change-Id: Id2b80d3fdb73cb5a3b3badedfc6db9620cf25ef9 Issue-ID: VFC-626 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--res/docker/Dockerfile2
-rw-r--r--res/res/resources/views.py24
2 files changed, 17 insertions, 9 deletions
diff --git a/res/docker/Dockerfile b/res/docker/Dockerfile
index 50dbd25..e1f65a8 100644
--- a/res/docker/Dockerfile
+++ b/res/docker/Dockerfile
@@ -30,7 +30,7 @@ ADD . /service
WORKDIR /service
# get binary zip from nexus
-RUN wget -q -O vfc-gvnfm-vnfres.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vfc.gvnfm.vnfres.res&a=vfc-gvnfm-vnfres-res&v=1.0.2&e=zip' && \
+RUN wget -q -O vfc-gvnfm-vnfres.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.vfc.gvnfm.vnfres.res&a=vfc-gvnfm-vnfres-res&v=1.0.2&e=zip' && \
unzip vfc-gvnfm-vnfres.zip && \
rm -rf vfc-gvnfm-vnfres.zip
diff --git a/res/res/resources/views.py b/res/res/resources/views.py
index 7356089..f442931 100644
--- a/res/res/resources/views.py
+++ b/res/res/resources/views.py
@@ -41,7 +41,8 @@ def get_vnf(request, *args, **kwargs):
return Response(data={'error': 'Vnf(%s) does not exist' % vnf_inst_id}, status=status.HTTP_404_NOT_FOUND)
resp_data = fill_resp_data(vnf_inst[0])
return Response(data=resp_data, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get Vnf(%s)' % vnf_inst_id}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -165,7 +166,8 @@ def get_vnfs(request):
for vnf_inst in vnf_insts:
arr.append(fill_resp_data(vnf_inst))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- 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)
@@ -182,7 +184,8 @@ def get_vms(request, *args, **kwargs):
for vm in vms:
arr.append(fill_vms_data(vm))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get Vms'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -221,7 +224,8 @@ def get_flavors(request, *args, **kwargs):
for flavour in flavours:
arr.append(fill_flavours_data(flavour))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get flavours'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -254,7 +258,8 @@ def get_networks(request, *args, **kwargs):
for network in networks:
arr.append(fill_networks_data(network))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get networks'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -283,7 +288,8 @@ def get_subnets(request, *args, **kwargs):
for subnet in subnets:
arr.append(fill_subnets_data(subnet))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get subnets'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -314,7 +320,8 @@ def get_cps(request, *args, **kwargs):
for cp in cps:
arr.append(fill_cps_data(cp))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get cps'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -344,7 +351,8 @@ def get_volumes(request, *args, **kwargs):
for v in volumes:
arr.append(fill_volumes_data(v))
return Response(data={'resp_data': arr}, status=status.HTTP_200_OK)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
return Response(data={'error': 'Failed to get volumes'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)