Comment 5 for bug 1813085

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/633288
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=af3aef940c0162f12752a65282368d16c2d17c4f
Submitter: Zuul
Branch: master

commit af3aef940c0162f12752a65282368d16c2d17c4f
Author: Lance Bragstad <email address hidden>
Date: Fri Jan 25 20:55:15 2019 +0000

    Handle special cases with msgpack and python3

    We attempt to be clever about string types in the token formatters.
    We do this because in some cases, not all items in a token payload
    are serialized to byte strings. To add flexibility for this, we use
    tuples with a boolean value that denotes if the accompanying value is
    a byte string or not. This helps us safely re-inflate the value from
    a byte string back to it's .hex representations, typically with UUID
    strings.

    With python3, we actually hit an interesting case where what we pass
    into the token payload doesn't actually maintain that state due to the
    usage of msgpack. The msgpack library returns byte strings even though
    the initial value may not have been a byte string. This breaks the
    logic we have for the associated boolean value because the string type
    changes and the boolean does not.

    This commit adds a couple of if/statements to detect if we running on
    python3 and if the boolean mismatches the actual value type. Then, it
    attempts to do the right thing by decoding the string.

    We should think about how we want to do this, or if there is a better
    way.

    Change-Id: Iaecd45ef985cbf5ff4a6a724df96c1304a927247
    Closes-Bug: 1813085