summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-01-10 10:21:21 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-01-10 10:21:21 +0800
commit358310fd8c7c0863800de3b22a5a9d8ce2fb3b7e (patch)
tree16a51d8724e4c9f93e75c8e95776ff198d247073
parentc4390ea3f4fc000058e3a1d24e38a4143671ba97 (diff)
Fix vfc-vnflcm pep8 issues
Change-Id: Ie95e04333e1665f3d14cde716e8c8b175feef572 Issue-ID: VFC-630 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_create.py2
-rw-r--r--lcm/lcm/nf/vnfs/views.py18
-rw-r--r--lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py5
-rw-r--r--lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py3
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py5
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py3
6 files changed, 25 insertions, 11 deletions
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
index 7965072d..2c4a2ea9 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
@@ -106,7 +106,7 @@ class TestNFInstantiate(TestCase):
self.assert_job_result(self.job_id, 255, "VNF nf_inst_id is not exist.")
@mock.patch.object(restcall, 'call_req')
- def test_instantiate_vnf_when_get_rawdata_by_csarid_failed(self, mock_call_req):
+ def test_instantiate_vnf_when_get_packageinfo_by_csarid_failed(self, mock_call_req):
NfInstModel.objects.create(nfinstid='1111',
nf_name='vFW_01',
package_id='222',
diff --git a/lcm/lcm/nf/vnfs/views.py b/lcm/lcm/nf/vnfs/views.py
index 495e782a..cfdf2800 100644
--- a/lcm/lcm/nf/vnfs/views.py
+++ b/lcm/lcm/nf/vnfs/views.py
@@ -38,7 +38,8 @@ 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:
+ 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,7 +52,8 @@ 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 = {
@@ -70,7 +72,8 @@ 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 = {
@@ -87,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)
@@ -100,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)
@@ -116,7 +121,8 @@ 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 = {
diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
index 65dc677e..d24cc081 100644
--- a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
+++ b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
@@ -13,6 +13,7 @@
# limitations under the License.
import logging
+import traceback
from lcm.pub.database.models import NfInstModel, NfvoRegInfoModel
from lcm.pub.exceptions import NFLCMException
@@ -31,7 +32,9 @@ class DeleteVnf:
self.delete_info_from_db()
except NFLCMException as e:
logger.debug('Delete VNF instance[%s] failed: %s', self.nf_inst_id, e.message)
- except:
+ except Exception as e:
+ logger.error(e.message)
+ logger.error(traceback.format_exc())
logger.debug('Delete VNF instance[%s] failed' % self.nf_inst_id)
def check_parameter(self):
diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
index 12df170b..21babf51 100644
--- a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
@@ -60,7 +60,8 @@ class TermVnf(Thread):
JobUtil.add_job_status(self.job_id, 100, "Terminate Vnf success.")
except NFLCMException as e:
self.vnf_term_failed_handle(e.message)
- except:
+ except Exception as e:
+ logger.error(e.message)
self.vnf_term_failed_handle(traceback.format_exc())
def term_pre(self):
diff --git a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
index 593248dd..12f540da 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
@@ -13,6 +13,7 @@
# limitations under the License.
import logging
+import traceback
import uuid
from lcm.pub.database.models import NfInstModel
@@ -41,7 +42,9 @@ class CreateVnf:
except NFLCMException as e:
logger.debug('Create VNF instance[%s]: %s', self.nf_inst_id, e.message)
raise NFLCMException(e.message)
- except:
+ except Exception as e:
+ logger.error(e.message)
+ logger.error(traceback.format_exc())
NfInstModel.objects.create(nfinstid=self.nf_inst_id,
nf_name=self.vnf_instance_mame,
package_id='',
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index a1f66391..59ec9930 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -53,7 +53,8 @@ class InstVnf(Thread):
JobUtil.add_job_status(self.job_id, 100, "Instantiate Vnf success.")
except NFLCMException as e:
self.vnf_inst_failed_handle(e.message)
- except:
+ except Exception as e:
+ logger.error(e.message)
logger.error(traceback.format_exc())
self.vnf_inst_failed_handle('unexpected exception')