Wrong negociation version

Bug #1475308 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
Fix Released
High
Lucas Alvares Gomes

Bug Description

When the python client catch a 406 (Not Acceptable) error talking to an older version of the Ironic server the client will try to negotiate and fall back to the minimum supported version.

Currently the code that does this negotiation is broken if the version requested is >= 1.10 [1]

<snippet>

negotiated_ver = min(self.os_ironic_api_version, max_ver)
        if negotiated_ver < min_ver:
            negotiated_ver = min_ver

</snippet>

A simple test in python can verify that:

In [4]: min('1.10', '1.6')
Out[4]: '1.10'

In [5]: min('1.9', '1.6')
Out[5]: '1.6'

[1] https://github.com/openstack/python-ironicclient/blob/master/ironicclient/common/http.py#L129

Changed in python-ironicclient:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

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

Changed in python-ironicclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

Reviewed: https://review.openstack.org/202565
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=c3d38c921e847cae02db5785e5068cff9785ec06
Submitter: Jenkins
Branch: master

commit c3d38c921e847cae02db5785e5068cff9785ec06
Author: Lucas Alvares Gomes <email address hidden>
Date: Thu Jul 16 14:36:37 2015 +0100

    Fix version negotiation

    When the python client catch a 406 (Not Acceptable) error talking to
    an older version of the Ironic server the client will try to negotiate
    and fall back to the minimum supported version. Before the code was
    determining the minimum version by using the builtin min() method with
    strings but the result doesn't always come correct by doing it, e.g:

    In [1]: min('1.10', '1.6')
    Out[1]: '1.10'

    In [2]: min('1.9', '1.6')
    Out[2]: '1.6'

    This patch fix this problem with the version negotiation.

    Closes-Bug: #1475308
    Change-Id: I2c756288d9590d1d18574a787601681b235fb57d

Changed in python-ironicclient:
status: In Progress → Fix Committed
Changed in python-ironicclient:
milestone: none → 0.8.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.