oslo shouldn't be using str() in LOG and exception messages

Bug #1286306 reported by Jay Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
High
Jay Bryant
oslo.messaging
Undecided
ChangBo Guo(gcb)

Bug Description

Using str() on LOG and exception messages can cause logging in gettextutils to fail.

Use of str() should be removed.

Jay Bryant (jsbryant)
Changed in oslo:
assignee: nobody → Jay Bryant (jsbryant)
Changed in oslo:
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/77722

Changed in oslo:
status: Triaged → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Related fix proposed to oslo.messaging (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/90577

Changed in oslo.messaging:
assignee: nobody → ChangBo Guo(gcb) (glongwave)
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/77722
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=8a0f5678485076fbe0ea1f318c7fd49bac3f1df8
Submitter: Jenkins
Branch: master

commit 8a0f5678485076fbe0ea1f318c7fd49bac3f1df8
Author: Jay S. Bryant <email address hidden>
Date: Mon Mar 3 16:52:54 2014 -0600

    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

Changed in oslo:
status: In Progress → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Related fix merged to oslo.messaging (master)

Reviewed: https://review.openstack.org/90577
Committed: https://git.openstack.org/cgit/openstack/oslo.messaging/commit/?id=23edc1b4ce8af2a2a4c3eb3c9c095354f3983d8b
Submitter: Jenkins
Branch: master

commit 23edc1b4ce8af2a2a4c3eb3c9c095354f3983d8b
Author: ChangBo Guo(gcb) <email address hidden>
Date: Sun Apr 27 10:21:21 2014 +0800

    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.

    Copied from https://review.openstack.org/#/c/77722

    Change-Id: I082af5c9ae8bf9859382c2c387b10b48358e10b3
    Related-Bug: #1286306

Thierry Carrez (ttx)
Changed in oslo:
milestone: none → juno-1
status: Fix Committed → Fix Released
Mehdi Abaakouk (sileht)
Changed in oslo.messaging:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers