resolve python2->python3 issues 98/90998/1
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Mon, 8 Jul 2019 03:53:13 +0000 (11:53 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Mon, 8 Jul 2019 03:53:13 +0000 (11:53 +0800)
resolve e.message issues

Change-Id: Ib55c1ddfe12a428c06b018d60008d1fa90fca979
Issue-ID: VFC-1429
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
23 files changed:
lcm/ns/biz/ns_create.py
lcm/ns/biz/ns_delete.py
lcm/ns/biz/ns_instantiate_flow.py
lcm/ns/biz/ns_terminate.py
lcm/ns/biz/ns_update.py
lcm/ns/views/deprecated/create_ns_view.py
lcm/ns/views/deprecated/get_del_ns_view.py
lcm/ns_pnfs/views/pnf_view.py
lcm/ns_sfcs/biz/create_sfc_worker.py
lcm/ns_sfcs/biz/delete_sfcs.py
lcm/ns_sfcs/views/views.py
lcm/ns_vls/biz/create_vls.py
lcm/ns_vls/biz/delete_vls.py
lcm/ns_vnfs/biz/create_vnfs.py
lcm/ns_vnfs/biz/handle_notification.py
lcm/ns_vnfs/biz/notify_lcm.py
lcm/ns_vnfs/biz/terminate_nfs.py
lcm/ns_vnfs/biz/update_vnfs.py
lcm/ns_vnfs/views/vnf_views.py
lcm/pub/nfvi/vim/api/openstack/image.py
lcm/pub/nfvi/vim/api/openstack/network.py
lcm/pub/nfvi/vim/vimadaptor.py
lcm/samples/views.py

index 5fba81b..1cb4e0c 100644 (file)
@@ -89,6 +89,6 @@ class CreateNSService(object):
             resp_data, resp_status = create_ns_aai(self.global_customer_id, self.service_type, self.ns_inst_id, data)
             logger.debug("Success to create ns[%s] to aai:[%s],[%s].", self.ns_inst_id, resp_data, resp_status)
         except NSLCMException as e:
-            logger.debug("Fail to createns[%s] to aai, detail message: %s" % (self.ns_inst_id, e.message))
+            logger.debug("Fail to createns[%s] to aai, detail message: %s" % (self.ns_inst_id, e.args[0]))
         except:
             logger.error(traceback.format_exc())
index 2d25190..9bfad7b 100644 (file)
@@ -67,6 +67,6 @@ class DeleteNsService(object):
                                                        self.ns_inst_id, resource_version)
                 logger.debug("Success to delete ns[%s] from aai, resp_status: [%s]." % (self.ns_inst_id, resp_status))
         except NSLCMException as e:
-            logger.debug("Fail to delete ns[%s] from aai, detail message: %s" % (self.ns_inst_id, e.message))
+            logger.debug("Fail to delete ns[%s] from aai, detail message: %s" % (self.ns_inst_id, e.args[0]))
         except:
             logger.error(traceback.format_exc())
index c840a75..0605751 100644 (file)
@@ -82,14 +82,14 @@ def run_ns_instantiate(input_data, occ_id):
             NsLcmOpOcc.update(occ_id, "COMPLETED")
             ns_instantiate_ok = True
     except NSLCMException as e:
-        logger.error("Failded to Create NS: %s", e.message)
+        logger.error("Failded to Create NS: %s", e.args[0])
         update_job(job_id, JOB_PROGRESS.ERROR, JOB_ERROR_CODE.ERROR, "Failded to Create NS.")
-        NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.message)
+        NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.args[0])
         post_deal(ns_inst_id, "false")
     except Exception as e:
         logger.error(traceback.format_exc())
         update_job(job_id, JOB_PROGRESS.ERROR, JOB_ERROR_CODE.ERROR, "Failded to Create NS.")
-        NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.message)
+        NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.args[0])
         post_deal(ns_inst_id, "false")
     return ns_instantiate_ok
 
index 59c99da..b2776a6 100644 (file)
@@ -57,13 +57,13 @@ class TerminateNsService(threading.Thread):
             JobUtil.add_job_status(self.job_id, JOB_PROGRESS.FINISHED, "ns terminate ends.", '')
             NsLcmOpOcc.update(self.occ_id, "COMPLETED")
         except NSLCMException as e:
-            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
-            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
+            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
         except Exception as e:
-            logger.error(e.message)
+            logger.error(e.args[0])
             logger.error(traceback.format_exc())
             JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, "ns terminate fail.")
-            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
 
     def cancel_vl_list(self):
         array_vlinst = VLInstModel.objects.filter(ownertype=OWNER_TYPE.NS, ownerid=self.ns_inst_id)
@@ -82,7 +82,7 @@ class TerminateNsService(threading.Thread):
                     if str(result) == '0':
                         delete_result = "success"
             except Exception as e:
-                logger.error("[cancel_vl_list] error[%s]!" % e.message)
+                logger.error("[cancel_vl_list] error[%s]!" % e.args[0])
                 logger.error(traceback.format_exc())
             job_msg = "Delete vlinst:[%s] %s." % (vlinst.vlinstanceid, delete_result)
             JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
@@ -104,7 +104,7 @@ class TerminateNsService(threading.Thread):
                     if str(result) == '0':
                         delete_result = "success"
             except Exception as e:
-                logger.error("[cancel_sfc_list] error[%s]!" % e.message)
+                logger.error("[cancel_sfc_list] error[%s]!" % e.args[0])
                 logger.error(traceback.format_exc())
             job_msg = "Delete sfcinst:[%s] %s." % (sfcinst.sfcid, delete_result)
             JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
@@ -126,7 +126,7 @@ class TerminateNsService(threading.Thread):
                 if vnf_job_id:
                     delete_result = "deleting"
             except Exception as e:
-                logger.error("[cancel_vnf_list] error[%s]!" % e.message)
+                logger.error("[cancel_vnf_list] error[%s]!" % e.args[0])
                 logger.error(traceback.format_exc())
             job_msg = "Delete vnfinst:[%s] %s." % (vnfinst.nfinstid, delete_result)
             JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
@@ -209,7 +209,7 @@ class TerminateNsService(threading.Thread):
                     if ret[0] == 0:
                         delete_result = "success"
                 except Exception as e:
-                    logger.error("[cancel_pnf_list] error[%s]!" % e.message)
+                    logger.error("[cancel_pnf_list] error[%s]!" % e.args[0])
                     logger.error(traceback.format_exc())
                 job_msg = "Delete pnfinst:[%s] %s" % (pnfinst.pnfId, delete_result)
                 cur_progress += step_progress
index 95edd3b..6d996d2 100644 (file)
@@ -44,12 +44,12 @@ class NSUpdateService(threading.Thread):
             self.do_biz()
         except NSLCMException as e:
             logger.error(traceback.format_exc())
-            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
-            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
+            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
         except Exception as e:
             logger.error(traceback.format_exc())
             JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, 'ns update fail')
-            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+            NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
 
     def do_biz(self):
         self.update_job(JOB_PROGRESS.STARTED, desc='ns update start')
index cdc72cf..4fb6f93 100644 (file)
@@ -50,8 +50,8 @@ class CreateNSView(APIView):
             return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in GetNS: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in GetNS: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
     @swagger_auto_schema(
         request_body=_CreateNsReqSerializer(),
index da403b0..2bb34c0 100644 (file)
@@ -50,8 +50,8 @@ class NSDetailView(APIView):
             return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in GetNSDetail: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in GetNSDetail: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
     @swagger_auto_schema(
         request_body=None,
@@ -67,5 +67,5 @@ class NSDetailView(APIView):
             return Response(data={}, status=status.HTTP_204_NO_CONTENT)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in delete NS: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in delete NS: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
index ad435f9..72dddaf 100644 (file)
@@ -76,8 +76,8 @@ class PnfView(APIView):
             return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in GetPnf: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in GetPnf: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
 
 class IndividualPnfView(APIView):
@@ -95,8 +95,8 @@ class IndividualPnfView(APIView):
             return Response(data={}, status=status.HTTP_204_NO_CONTENT)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in delete pnf: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in delete pnf: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
     @swagger_auto_schema(
         request_body=None,
@@ -120,5 +120,5 @@ class IndividualPnfView(APIView):
             return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in IndividualPnfView: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in IndividualPnfView: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
index 04216ee..9e2bca8 100644 (file)
@@ -61,7 +61,7 @@ class CreateSfcWorker(Thread):
             self.handle_exception(e)
 
     def handle_exception(self, e):
-        detail = "sfc instantiation failed, detail message: %s" % e.message
+        detail = "sfc instantiation failed, detail message: %s" % e.args[0]
         JobUtil.add_job_status(self.job_id, 255, "create sfc failed!", "")
         logger.error(traceback.format_exc())
         logger.error(detail)
index 23fed4c..292e83e 100644 (file)
@@ -46,7 +46,7 @@ class DeleteSfcs(object):
             return self.exception_handle(e)
 
     def exception_handle(self, e):
-        detail = 'sfc delete failed, detail message: %s' % e.message
+        detail = 'sfc delete failed, detail message: %s' % e.args[0]
         logger.error(detail)
         return {"result": 1, "detail": detail}
 
index 6725700..6f1d81c 100644 (file)
@@ -68,7 +68,7 @@ class SfcInstanceView(APIView):
             return Response(data=rsp, status=status.HTTP_200_OK)
         except Exception as e:
             logger.error(traceback.format_exc())
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
 
 class PortPairGpView(APIView):
@@ -151,7 +151,7 @@ class SfcView(APIView):
             if not req_serializer.is_valid():
                 raise Exception(req_serializer.errors)
         except Exception as e:
-            logger.error("Exception occurs: %s", e.message)
+            logger.error("Exception occurs: %s", e.args[0])
             logger.error(traceback.format_exc())
         data = {
             'nsinstid': ignorcase_get(request.data, 'nsInstanceId'),
index 0746af5..1ddd7ce 100644 (file)
@@ -67,7 +67,7 @@ class CreateVls(object):
             return self.exception_handle(e)
 
     def exception_handle(self, e):
-        detail = "vl instantiation failed, detail message: %s" % e.message
+        detail = "vl instantiation failed, detail message: %s" % e.args[0]
         logger.error(detail)
         return {"result": 1, "detail": detail, "vlId": self.vl_inst_id}
 
@@ -247,6 +247,6 @@ class CreateVls(object):
             resp_data, resp_status = create_network_aai(self.vl_inst_id, data)
             logger.debug("Success to create network[%s] to aai: [%s].", self.vl_inst_id, resp_status)
         except NSLCMException as e:
-            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (self.vl_inst_id, e.message))
+            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (self.vl_inst_id, e.args[0]))
         except:
             logger.error(traceback.format_exc())
index 77a8ae5..65ca90d 100644 (file)
@@ -97,9 +97,9 @@ class DeleteVls(object):
             resp_data, resp_status = delete_network_aai(self.vl_inst_id, resource_version)
             logger.debug("Delete network[%s] from aai successfully, status: %s", self.vl_inst_id, resp_status)
         except NSLCMException as e:
-            logger.debug("Fail to delete network[%s] from aai: %s", self.vl_inst_id, e.message)
+            logger.debug("Fail to delete network[%s] from aai: %s", self.vl_inst_id, e.args[0])
         except Exception as e:
-            logger.error("Exception occurs when delete network[%s] from aai: %s", self.vl_inst_id, e.message)
+            logger.error("Exception occurs when delete network[%s] from aai: %s", self.vl_inst_id, e.args[0])
             logger.error(traceback.format_exc())
 
     def delete_vl_from_db(self, vl_inst_info):
index 4d7457b..2875887 100644 (file)
@@ -96,7 +96,7 @@ class CreateVnfs(Thread):
             self.save_info_to_db()
             JobUtil.add_job_status(self.job_id, JOB_PROGRESS.FINISHED, 'vnf instantiation success', JOB_ERROR_CODE.NO_ERROR)
         except NSLCMException as e:
-            self.vnf_inst_failed_handle(e.message)
+            self.vnf_inst_failed_handle(e.args[0])
         except Exception:
             logger.error(traceback.format_exc())
             self.vnf_inst_failed_handle('unexpected exception')
@@ -398,7 +398,7 @@ class CreateVnfs(Thread):
         try:
             SubscriptionCreation(data).do_biz()
         except Exception as e:
-            logger.error("subscribe failed: %s", e.message)
+            logger.error("subscribe failed: %s", e.args[0])
 
     def write_vnf_creation_info(self):
         logger.debug("write_vnf_creation_info start")
@@ -474,6 +474,6 @@ class CreateVnfs(Thread):
                          % (self.nf_inst_id, self.ns_inst_id, resp_status))
         except NSLCMException as e:
             logger.debug("Fail to create vnf[%s] to aai, ns instance=[%s], detail message: %s"
-                         % (self.nf_inst_id, self.ns_inst_id, e.message))
+                         % (self.nf_inst_id, self.ns_inst_id, e.args[0]))
         except:
             logger.error(traceback.format_exc())
index fcc8bf0..b907780 100644 (file)
@@ -55,7 +55,7 @@ class HandleVnfLcmOocNotification(object):
                 self.update_network_in_aai()
             logger.debug("notify lcm end")
         except NSLCMException as e:
-            exception(e.message)
+            exception(e.args[0])
         except Exception:
             logger.error(traceback.format_exc())
             exception('unexpected exception')
@@ -177,7 +177,7 @@ class HandleVnfLcmOocNotification(object):
                 else:
                     logger.error('affectedVl struct error: changeType not in {ADDED, REMOVED, MODIFIED, TEMPORARY}')
         except NSLCMException as e:
-            logger.debug("Fail to create internal network to aai, detail message: %s" % e.message)
+            logger.debug("Fail to create internal network to aai, detail message: %s" % e.args[0])
         except:
             logger.error(traceback.format_exc())
 
@@ -208,7 +208,7 @@ class HandleVnfLcmOocNotification(object):
             resp_data, resp_status = create_network_aai(vlInstanceId, data)
             logger.debug("Success to create network[%s] to aai: [%s].", vlInstanceId, resp_status)
         except NSLCMException as e:
-            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -224,7 +224,7 @@ class HandleVnfLcmOocNotification(object):
             logger.debug("Success to delete network[%s] from aai, resp_status: [%s]."
                          % (vlInstanceId, resp_status))
         except NSLCMException as e:
-            logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+            logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -264,7 +264,7 @@ class HandleVnfLcmOocNotification(object):
                          % (vserver_id, self.vnf_instid, resp_status))
         except NSLCMException as e:
             logger.debug("Fail to create vserver to aai, vnf instance=[%s], detail message: %s"
-                         % (self.vnf_instid, e.message))
+                         % (self.vnf_instid, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -288,7 +288,7 @@ class HandleVnfLcmOocNotification(object):
                 (vserver_id, resp_status))
             logger.debug("delete_vserver_in_aai end!")
         except NSLCMException as e:
-            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
         except:
             logger.error(traceback.format_exc())
 
index e5d42a2..22a2424 100644 (file)
@@ -57,7 +57,7 @@ class NotifyLcm(object):
                 self.update_network_in_aai()
             logger.debug("notify lcm end")
         except NSLCMException as e:
-            self.exception(e.message)
+            self.exception(e.args[0])
         except Exception:
             logger.error(traceback.format_exc())
             self.exception('unexpected exception')
@@ -122,7 +122,7 @@ class NotifyLcm(object):
                 (vserver_id, resp_status))
             logger.debug("delete_vserver_in_aai end!")
         except NSLCMException as e:
-            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
         except:
             logger.error(traceback.format_exc())
 
@@ -224,7 +224,7 @@ class NotifyLcm(object):
                 else:
                     logger.error('affectedVl struct error: changeType not in {added,removed,modified}')
         except NSLCMException as e:
-            logger.debug("Fail to create internal network to aai, detail message: %s" % e.message)
+            logger.debug("Fail to create internal network to aai, detail message: %s" % e.args[0])
         except:
             logger.error(traceback.format_exc())
 
@@ -255,7 +255,7 @@ class NotifyLcm(object):
             resp_data, resp_status = create_network_aai(vlInstanceId, data)
             logger.debug("Success to create network[%s] to aai: [%s].", vlInstanceId, resp_status)
         except NSLCMException as e:
-            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+            logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -271,7 +271,7 @@ class NotifyLcm(object):
             logger.debug("Success to delete network[%s] from aai, resp_status: [%s]."
                          % (vlInstanceId, resp_status))
         except NSLCMException as e:
-            logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+            logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -311,6 +311,6 @@ class NotifyLcm(object):
                          % (vserver_id, self.vnf_instid, resp_status))
         except NSLCMException as e:
             logger.debug("Fail to create vserver to aai, vnf instance=[%s], detail message: %s"
-                         % (self.vnf_instid, e.message))
+                         % (self.vnf_instid, e.args[0]))
         except:
             logger.error(traceback.format_exc())
index 6cbabc1..86d608e 100644 (file)
@@ -64,10 +64,10 @@ class TerminateVnfs(threading.Thread):
             self.delete_subscription()
             self.delete_data_from_db()
         except NSLCMException as e:
-            self.set_job_err(e.message)
+            self.set_job_err(e.args[0])
         except Exception as ex:
             logger.error(traceback.format_exc())
-            self.set_job_err(ex.message)
+            self.set_job_err(ex.args[0])
 
     def set_vnf_status(self, vnf_inst_info):
         vnf_status = vnf_inst_info.status
@@ -141,7 +141,7 @@ class TerminateVnfs(threading.Thread):
         try:
             SubscriptionDeletion(self.vnfm_inst_id, self.vnf_inst_id).do_biz()
         except Exception as e:
-            logger.error("delete_subscription failed: %s", e.message)
+            logger.error("delete_subscription failed: %s", e.args[0])
 
     def delete_data_from_db(self):
         NfInstModel.objects.filter(nfinstid=self.vnf_inst_id).delete()
@@ -161,7 +161,7 @@ class TerminateVnfs(threading.Thread):
             logger.debug(
                 "Success to delete vnf[%s] from aai, resp_status: [%s]." % (self.vnf_inst_id, resp_status))
         except NSLCMException as e:
-            logger.debug("Fail to delete vnf from aai[%s], detail message: %s" % (self.vnf_inst_id, e.message))
+            logger.debug("Fail to delete vnf from aai[%s], detail message: %s" % (self.vnf_inst_id, e.args[0]))
         except:
             logger.error(traceback.format_exc())
 
@@ -189,6 +189,6 @@ class TerminateVnfs(threading.Thread):
                     (vserver_id, resp_status))
             logger.debug("delete_vserver_in_aai end!")
         except NSLCMException as e:
-            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+            logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
         except:
             logger.error(traceback.format_exc())
index ad587fd..012abd9 100644 (file)
@@ -46,7 +46,7 @@ class NFOperateService(threading.Thread):
         try:
             self.do_biz()
         except NSLCMException as e:
-            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
+            JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
         except:
             logger.error(traceback.format_exc())
             JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, 'nf update fail')
index 593ac76..d5388b4 100644 (file)
@@ -94,8 +94,8 @@ class VnfNotifyView(APIView):
             return Response(data={}, status=status.HTTP_204_NO_CONTENT)
         except Exception as e:
             logger.error(traceback.format_exc())
-            logger.error("Exception in VnfLcmOoc Notification: %s", e.message)
-            return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            logger.error("Exception in VnfLcmOoc Notification: %s", e.args[0])
+            return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
 
     @swagger_auto_schema(
         responses={
index 2a04cb9..8189aa7 100644 (file)
@@ -36,7 +36,7 @@ class ImageUploadThread(threading.Thread):
             self.glance.images.upload(self.image_id, open(self.image_path, 'rb'))
         except Exception as ex:
             logger.error(traceback.format_exc())
-            err_msg = ex.message if ex.message else str(sys.exc_info())
+            err_msg = ex.args[0] if ex.args[0] else str(sys.exc_info())
             logger.error("Failed to upload image(%s): %s", self.image_id, err_msg)
         except:
             logger.error(traceback.format_exc())
index 3c3db3d..adeab6b 100644 (file)
@@ -37,8 +37,8 @@ def query_net(auth_info, net_id):
         keystone = auth_info["keystone"]
         tenant = keystone.tenants.get(tenant_id=net["tenant_id"])
     except NetworkNotFoundClient as e:
-        logger.warn("NetworkNotFoundClient: %s", e.message)
-        return [2, e.message]
+        logger.warn("NetworkNotFoundClient: %s", e.args[0])
+        return [2, e.args[0]]
     return [0, {
         "id": net["id"],
         "name": net["name"],
@@ -86,8 +86,8 @@ def query_subnet(auth_info, subnet_id):
     try:
         subnet_info = neutron.show_subnet(subnet_id)["subnet"]
     except SubnetNotFound as e:
-        logger.warn("SubnetNotFound: %s", e.message)
-        return [2, e.message]
+        logger.warn("SubnetNotFound: %s", e.args[0])
+        return [2, e.args[0]]
     ret = [0, {}]
     ret[1]["id"] = subnet_id
     ret[1]["name"] = subnet_info["name"]
@@ -108,8 +108,8 @@ def query_port(auth_info, port_id):
     try:
         port_info = neutron.show_port(port_id)["port"]
     except NeutronClientException as e:
-        logger.warn("NeutronClientException: %s", e.message)
-        return [2, e.message]
+        logger.warn("NeutronClientException: %s", e.args[0])
+        return [2, e.args[0]]
     ret = [0, {}]
     ret[1]["id"] = port_id
     ret[1]["name"] = port_info["name"]
@@ -236,7 +236,7 @@ def create_port(auth_info, data):
     try:
         port_created = neutron.create_port(create_param)
     except NeutronClientException as ex:
-        logger.info("create_port exception: %s, %s", str(sys.exc_info()), ex.message)
+        logger.info("create_port exception: %s, %s", str(sys.exc_info()), ex.args[0])
         create_param['port'].pop('security_groups')
         if 'allowed_address_pairs' in create_param['port']:
             create_param['port'].pop('allowed_address_pairs')
@@ -372,7 +372,7 @@ def create_subnet(neutron, network_id, data):
     except Exception as ex:
         logger.error(traceback.format_exc())
         logger.error(str(sys.exc_info()))
-        return [1, ex.message if ex.message else str(sys.exc_info())]
+        return [1, ex.args[0] if ex.args[0] else str(sys.exc_info())]
 
 
 def rollback(neutron, network_data):
@@ -398,10 +398,10 @@ def delete_network(auth_info, network_id):
         neutron.delete_network(network_id)
     except Exception as ex:
         logger.error(traceback.format_exc())
-        msg = ex.message if ex.message else str(sys.exc_info())
+        msg = ex.args[0] if ex.args[0] else str(sys.exc_info())
         logger.error(msg)
         if 404 == ex.status_code:
-            return [0, ex.message]
+            return [0, ex.args[0]]
         return [1, "Vim exception."]
     return [0, "Network(%s) is deleted" % network_id]
 
@@ -411,8 +411,8 @@ def delete_subnet(auth_info, subnet_id):
     try:
         neutron.delete_subnet(subnet_id)
     except NeutronClientException as e:
-        logger.warn("[%s]NetworkNotFoundClient: %s", fun_name(), e.message)
-        return [0, e.message]
+        logger.warn("[%s]NetworkNotFoundClient: %s", fun_name(), e.args[0])
+        return [0, e.args[0]]
     return [0, "Subnet(%s) is deleted" % subnet_id]
 
 
@@ -421,6 +421,6 @@ def delete_port(auth_info, port_id):
     try:
         neutron.delete_port(port_id)
     except NeutronClientException as e:
-        logger.warn("[%s]NeutronClientException: %s", fun_name(), e.message)
-        return [0, e.message]
+        logger.warn("[%s]NeutronClientException: %s", fun_name(), e.args[0])
+        return [0, e.args[0]]
     return [0, "Port(%s) is deleted" % port_id]
index 1ad0a48..6203383 100644 (file)
@@ -43,14 +43,14 @@ class VimAdaptor:
         try:
             ret = fun(self.authInfo[1], *args) if self.authInfo[0] == 0 else self.authInfo
         except VimException as e:
-            ret = [1, e.message]
+            ret = [1, e.args[0]]
         except RequestException as e:
             logger.error("request=%s, url=%s" % (e.request.headers._store, e.request.url))
             logger.error(traceback.format_exc())
-            ret = [1, e.message if e.message else str(sys.exc_info())]
+            ret = [1, e.args[0] if e.args[0] else str(sys.exc_info())]
         except Exception as ex:
             logger.error(traceback.format_exc())
-            ret = [1, ex.message if ex.message else str(sys.exc_info())]
+            ret = [1, ex.args[0] if ex.args[0] else str(sys.exc_info())]
         except:
             logger.error(traceback.format_exc())
             ret = [1, str(sys.exc_info())]
index 5889aac..a22b7b1 100644 (file)
@@ -82,6 +82,6 @@ class TablesList(APIView):
                 raise Exception(resp_serializer.errors)
             return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
         except Exception as e:
-            logger.error(e.message)
+            logger.error(e.args[0])
             logger.error(traceback.format_exc())
-            return Response(data={"error": e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+            return Response(data={"error": e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)