From cf4e857dd2d7e6a7a63729257fdad2b599df8fc8 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Mon, 12 Jun 2017 01:36:59 -0700 Subject: [PATCH] Use e.exc_type instead of calling str on exception This fixes the usage of the oslo RemoteError exception checking in the Linux Bridge trunk driver to stop calling 'str' on the exception and just check the 'exc_type' attribute like we do in the other agent code so it's safe to use with unicode. Change-Id: I352ed422550343118319f8e83c4979f290f161f0 Closes-Bug: #1697383 --- neutron/services/trunk/drivers/linuxbridge/agent/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/services/trunk/drivers/linuxbridge/agent/driver.py b/neutron/services/trunk/drivers/linuxbridge/agent/driver.py index 238906f6ca2..0eb2d2044fc 100644 --- a/neutron/services/trunk/drivers/linuxbridge/agent/driver.py +++ b/neutron/services/trunk/drivers/linuxbridge/agent/driver.py @@ -136,7 +136,7 @@ class _TrunkAPI(object): except resources_rpc.ResourceNotFound: return None except oslo_messaging.RemoteError as e: - if 'CallbackNotFound' not in str(e): + if e.exc_type != 'CallbackNotFound': raise LOG.debug("Trunk plugin disabled on server. Assuming port %s is " "not a trunk.", port_id)