[Bug 1763179] Re: Returned strings should not be forced into unicode

OpenStack Infra 1763179 at bugs.launchpad.net
Wed Apr 25 17:19:49 UTC 2018


Reviewed:  https://review.openstack.org/561674
Committed: https://git.openstack.org/cgit/openstack/oslo.versionedobjects/commit/?id=b607dad267aff8ce87f956e9f2586b9e44a58f44
Submitter: Zuul
Branch:    stable/queens

commit b607dad267aff8ce87f956e9f2586b9e44a58f44
Author: Sean McGinnis <sean.mcginnis at gmail.com>
Date:   Wed Apr 11 21:02:53 2018 +0000

    Don't force unicode strings for UUID coercion
    
    Change Ic6b6308fb1960ec40407e6efde30137b64543e72 attempts to
    fix difference between Python 2 and Python 3 values by switching
    from using str() to formatting into a unicode string (u"%s").
    
    This is equivalent to changing str() to unicode(), but that is
    not correct for expected default string types for Python 2.
    This requires either using six.text_type(), or just formatting
    into a string, without forcing unicode ("%s"), to be correct on
    either runtime.
    
    Change-Id: I178f14cdc670d7a696778891e587ef75de208fc2
    Closes-bug: #1763179
    (cherry picked from commit b719764ba85d5e689d8276ad40c82985c84f03f9)


** Tags added: in-stable-queens

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-oslo.versionedobjects in
Ubuntu.
https://bugs.launchpad.net/bugs/1763179

Title:
  Returned strings should not be forced into unicode

Status in Ubuntu Cloud Archive:
  Fix Released
Status in Ubuntu Cloud Archive mitaka series:
  Triaged
Status in Ubuntu Cloud Archive ocata series:
  Fix Committed
Status in Ubuntu Cloud Archive pike series:
  Triaged
Status in Ubuntu Cloud Archive queens series:
  Fix Released
Status in oslo.versionedobjects:
  Fix Released
Status in python-oslo.versionedobjects package in Ubuntu:
  Fix Released
Status in python-oslo.versionedobjects source package in Xenial:
  Triaged
Status in python-oslo.versionedobjects source package in Artful:
  Triaged
Status in python-oslo.versionedobjects source package in Bionic:
  Fix Released

Bug description:
  SRU details for Ubuntu
  ----------------------
  [Impact]
  See Original Description below.

  [Test Case]

  1. deploy openstack env
  2. source novarc ( as admin )
  3. keystone user-create --name test
  4. openstack user set --password-prompt test
  4. log into keystone node and install mysql-client
  5. connect to mysql with keystone user
  6. do below query
  - set foreign_key_checks = 0;
  - update local_user set user_id='Gāo' where user_id='UUID';
  - update user set id='Gāo' where id='UUID';
  - set foreign_key_checks = 1;
  7. keystone user-role-add --user test --tenant admin --role Admin
  8. source novarc ( as test )
  9. cinder create --name test 1

  got unicode error on cinder-api node logs

  [Regression Potential]
  Low as the patch has landed upstream.

  
  Original Description
  --------------------
  Change https://review.openstack.org/#/c/557778/ changed the return value for coerce() to explicitly force the value to be unicode. This causes problems with Python 2 runtimes, where the expected value of a string is no longer a string but now unicode (see: https://github.com/openstack/cinder/blob/b89e73a2ac315927d2eee42129597b14e87ba685/cinder/tests/unit/volume/drivers/dell_emc/vmax/test_vmax.py#L3412)

  The correct fix should be to use either six.text_type to convert it,
  or format it into a string as is being done, but without forcing it to
  be a unicode string. "%s" will end up being the correct type depending
  on whether it is running under py2 or py3.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1763179/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list