From: Ying Liu Date: Fri, 19 Aug 2011 20:37:33 +0000 (-0700) Subject: replace exception handler by using cisco_exceptions X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7b215b44d8c19c1ca5172c78b8ea7963bcad1b75;p=openstack-build%2Fneutron-build.git replace exception handler by using cisco_exceptions --- diff --git a/extensions/credential.py b/extensions/credential.py index 8b51c81c2..85043940b 100644 --- a/extensions/credential.py +++ b/extensions/credential.py @@ -22,7 +22,8 @@ import logging from webob import exc from extensions import _credential_view as credential_view -from extensions import _exceptions as exception +from quantum.plugins.cisco.common import cisco_exceptions as exception +#from extensions import _exceptions as exception from extensions import _faults as faults from quantum.api import api_common as common diff --git a/extensions/novatenant.py b/extensions/novatenant.py index eddab4c17..5cbfc4bd0 100644 --- a/extensions/novatenant.py +++ b/extensions/novatenant.py @@ -21,7 +21,8 @@ from webob import exc from extensions import _novatenant_view as novatenant_view -from extensions import _exceptions as exception +from quantum.common import exceptions as qexception +#from extensions import _exceptions as exception from extensions import _faults as faults from quantum.api import api_common as common @@ -144,9 +145,7 @@ class NovatenantsController(common.QuantumController): result = builder.build_host(host) return result #return exc.HTTPAccepted() - except exception.NovatenantNotFound as exp: - return faults.Fault(faults.NovatenantNotFound(exp)) - except exception.PortNotFound as exp: + except qexception.PortNotFound as exp: return faults.Fault(faults.PortNotFound(exp)) def get_instance_port(self, request, tenant_id, id): @@ -169,7 +168,5 @@ class NovatenantsController(common.QuantumController): result = builder.build_vif(vif) return result - except exception.NovatenantNotFound as exp: - return faults.Fault(faults.NovatenantNotFound(exp)) - except exception.PortNotFound as exp: + except qexception.PortNotFound as exp: return faults.Fault(faults.PortNotFound(exp)) diff --git a/extensions/portprofile.py b/extensions/portprofile.py index 8186f6903..b0fbb65dd 100644 --- a/extensions/portprofile.py +++ b/extensions/portprofile.py @@ -22,7 +22,9 @@ from webob import exc from extensions import _pprofiles as pprofiles_view -from extensions import _exceptions as exception +from quantum.plugins.cisco.common import cisco_exceptions as exception +from quantum.common import exceptions as qexception +#from extensions import _exceptions as exception from extensions import _faults as faults from quantum.api import api_common as common @@ -126,7 +128,7 @@ class PortprofilesController(common.QuantumController): #build response with details result = builder.build(portprofile, True) return dict(portprofiles=result) - except exception.PortprofileNotFound as exp: + except exception.PortProfileNotFound as exp: return faults.Fault(faults.PortprofileNotFound(exp)) #return faults.Fault(exp) @@ -163,7 +165,7 @@ class PortprofilesController(common.QuantumController): builder = pprofiles_view.get_view_builder(request) result = builder.build(portprofile, True) return dict(portprofiles=result) - except exception.PortprofileNotFound as exp: + except exception.PortProfileNotFound as exp: return faults.Fault(faults.PortprofileNotFound(exp)) def delete(self, request, tenant_id, id): @@ -171,7 +173,7 @@ class PortprofilesController(common.QuantumController): try: self._plugin.delete_portprofile(tenant_id, id) return exc.HTTPAccepted() - except exception.PortprofileNotFound as exp: + except exception.PortProfileNotFound as exp: return faults.Fault(faults.PortprofileNotFound(exp)) def associate_portprofile(self, request, tenant_id, id): @@ -193,9 +195,9 @@ class PortprofilesController(common.QuantumController): net_id, port_id, id) return exc.HTTPAccepted() - except exception.PortprofileNotFound as exp: + except exception.PortProfileNotFound as exp: return faults.Fault(faults.PortprofileNotFound(exp)) - except exception.PortNotFound as exp: + except qexception.PortNotFound as exp: return faults.Fault(faults.PortNotFound(exp)) def disassociate_portprofile(self, request, tenant_id, id): @@ -217,7 +219,7 @@ class PortprofilesController(common.QuantumController): disassociate_portprofile(tenant_id, net_id, port_id, id) return exc.HTTPAccepted() - except exception.PortprofileNotFound as exp: + except exception.PortProfileNotFound as exp: return faults.Fault(faults.PortprofileNotFound(exp)) - except exception.PortNotFound as exp: + except qexception.PortNotFound as exp: return faults.Fault(faults.PortNotFound(exp)) diff --git a/extensions/qos.py b/extensions/qos.py index a11f41af7..3c0f3da78 100644 --- a/extensions/qos.py +++ b/extensions/qos.py @@ -22,7 +22,8 @@ import logging from webob import exc from extensions import _qos_view as qos_view -from extensions import _exceptions as exception +from quantum.plugins.cisco.common import cisco_exceptions as exception +from extensions import _exceptions as exte from extensions import _faults as faults from quantum.api import api_common as common