]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Allow api_version_request.matches to accept a string
authorscottda <scott.dangelo@hp.com>
Fri, 26 Feb 2016 13:17:08 +0000 (06:17 -0700)
committerscottda <scott.dangelo@hp.com>
Mon, 7 Mar 2016 19:58:59 +0000 (12:58 -0700)
commit72876024648052b25aac036add8c5feb2440e10f
tree14cf250162b9e314529c3217ba8f6fb59b9f1389
parent16aac2a659d4206c14f96dd335197d7cd4121ac3
Allow api_version_request.matches to accept a string

According to the Cinder devref you should be able to use the following
pattern:

    if req_version.matches("3.1", "3.5"):
        ....stuff....
    elif req_version.matches("3.6", "3.10"):
        ....other stuff....
    elif req_version > api_version_request.APIVersionRequest("3.10"):
        ....more stuff.....

However, the api_version_request.matches() function will not accept a
string, it requires an api_version_request object.

Fix this to accept a string, as well as None for object.

Closes-Bug: 1550337
Change-Id: Ic90f4a13cfad601a181fd3a91684ecbb2b2fba74
cinder/api/openstack/api_version_request.py
cinder/tests/unit/api/test_versions.py