Comment 2 for bug 1481478

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

Reviewed: https://review.openstack.org/209258
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=03542ee65a5e818a5d908a85a6a9eba21ef63b53
Submitter: Jenkins
Branch: master

commit 03542ee65a5e818a5d908a85a6a9eba21ef63b53
Author: Matt Riedemann <email address hidden>
Date: Tue Aug 4 14:20:53 2015 -0700

    Fix ClientException init when there is no message on py34

    BaseException.message was removed in python 3 per PEP 0352 so if no
    message is passed to the ClientException __init__ it will blow up:

    AttributeError: type object 'ClientException' has no attribute 'message'

    So this change does two things:

    1. Default to 'n/a' for message and details when body['keys'] doesn't
       have a message or details in it (which should be fine since
       from_response defaults to n/a if 'keys' is not in body).
    2. Use getattr for self.__class__.message and default to None if that
       attribute is not set. Arguably we could just remove this and make
       the message kwarg default to 'n/a' in ClientException.__init__ but
       I figured that was more invasive.

    Closes-Bug: #1481478

    Change-Id: I738cb9c8d4f015048c45a1df16bf18e29190e392