diff options
author | Jay S. Bryant <jsbryant@us.ibm.com> | 2014-03-03 16:52:54 -0600 |
---|---|---|
committer | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2014-04-27 10:48:12 +0800 |
commit | 8a0f5678485076fbe0ea1f318c7fd49bac3f1df8 (patch) | |
tree | d6b63386ddb5959dc08a1f270126c055a67fe615 /openstack/common/rpc/impl_qpid.py | |
parent | 28fba9c262943e3f6b0b10321680fc08cf6b8387 (diff) | |
download | oslo-incubator-8a0f5678485076fbe0ea1f318c7fd49bac3f1df8.tar.gz |
Remove str() from LOG.* and exceptions
gettextutils is expecting to receive unicode strings
rather than basestrings. A basestring can cause an
unhandled exception in the logging code. To help avoid
such issues we should remove str() from LOG.* messages and
exceptions. We have verified that the %s formatting code
properly handle getting strings to unicode where necessary.
This patch also fixes one case where a message object was
being concatenated with '+' . This, like using str() will
cause logging to fail and needs to be fixed.
See bug https://bugs.launchpad.net/cinder/+bug/1274245 for
the original discussion of this problem.
Fix for oslo.messaging: https://review.openstack.org/90577
Change-Id: Iad7c2284c6b21322b96dc881a82bbbab4ebb208e
Closes-bug: 1286306
Diffstat (limited to 'openstack/common/rpc/impl_qpid.py')
-rw-r--r-- | openstack/common/rpc/impl_qpid.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openstack/common/rpc/impl_qpid.py b/openstack/common/rpc/impl_qpid.py index dc47661d..3920b934 100644 --- a/openstack/common/rpc/impl_qpid.py +++ b/openstack/common/rpc/impl_qpid.py @@ -571,7 +571,7 @@ class Connection(object): add it to our list of consumers """ def _connect_error(exc): - log_info = {'topic': topic, 'err_str': str(exc)} + log_info = {'topic': topic, 'err_str': exc} LOG.error(_LE("Failed to declare consumer for topic '%(topic)s': " "%(err_str)s") % log_info) @@ -588,11 +588,11 @@ class Connection(object): def _error_callback(exc): if isinstance(exc, qpid_exceptions.Empty): LOG.debug('Timed out waiting for RPC response: %s' % - str(exc)) + exc) raise rpc_common.Timeout() else: LOG.exception(_LE('Failed to consume message from queue: %s') % - str(exc)) + exc) def _consume(): nxt_receiver = self.session.next_receiver(timeout=timeout) @@ -625,7 +625,7 @@ class Connection(object): """Send to a publisher based on the publisher class.""" def _connect_error(exc): - log_info = {'topic': topic, 'err_str': str(exc)} + log_info = {'topic': topic, 'err_str': exc} LOG.exception(_LE("Failed to publish message to topic " "'%(topic)s': %(err_str)s") % log_info) |