diff --git a/neutron_lib/rpc.py b/neutron_lib/rpc.py index 1a73a18ec..1faecbe4b 100644 --- a/neutron_lib/rpc.py +++ b/neutron_lib/rpc.py @@ -25,6 +25,7 @@ from neutron_lib.utils import runtime from oslo_config import cfg from oslo_log import log as logging import oslo_messaging +from oslo_messaging import exceptions as oslomsg_exc from oslo_messaging.rpc import dispatcher from oslo_messaging import serializer as om_serializer from oslo_service import service @@ -104,11 +105,7 @@ class _ContextWrapper(object): def cast(self, ctxt, method, **kwargs): try: self._original_context.cast(ctxt, method, **kwargs) - except Exception as e: - # TODO(kevinbenton): make catch specific to missing exchange once - # bug/1705351 is resolved on the oslo.messaging side; if - # oslo.messaging auto-creates the exchange, then just remove the - # code completely + except oslomsg_exc.MessageDeliveryFailure as e: LOG.debug("Ignored exception during cast: %s", str(e)) diff --git a/neutron_lib/tests/unit/test_rpc.py b/neutron_lib/tests/unit/test_rpc.py index b784e4ad7..8d63573a7 100644 --- a/neutron_lib/tests/unit/test_rpc.py +++ b/neutron_lib/tests/unit/test_rpc.py @@ -15,6 +15,7 @@ import mock from oslo_config import cfg import oslo_messaging as messaging from oslo_messaging import conffixture as messaging_conffixture +from oslo_messaging import exceptions as oslomsg_exc from oslo_messaging.rpc import dispatcher import testtools @@ -445,7 +446,7 @@ class CastExceptionTestCase(base.BaseTestCase): self.addCleanup(rpc.cleanup) rpc.init(CONF) rpc.TRANSPORT = mock.MagicMock() - rpc.TRANSPORT._send.side_effect = Exception + rpc.TRANSPORT._send.side_effect = oslomsg_exc.MessageDeliveryFailure target = messaging.Target(version='1.0', topic='testing') self.client = rpc.get_client(target) self.cast_context = mock.Mock()