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
This commit is contained in:
committed by
ChangBo Guo(gcb)
parent
7fdf1a28da
commit
28fd769235
@@ -224,7 +224,7 @@ def trycmd(*args, **kwargs):
|
||||
out, err = execute(*args, **kwargs)
|
||||
failed = False
|
||||
except ProcessExecutionError as exn:
|
||||
out, err = '', str(exn)
|
||||
out, err = '', six.text_type(exn)
|
||||
failed = True
|
||||
|
||||
if not failed and discard_warnings and err:
|
||||
|
||||
Reference in New Issue
Block a user