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
This commit is contained in:
Kevin Benton 2017-06-12 01:36:59 -07:00
parent b6bd475629
commit cf4e857dd2

View File

@ -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)