Malformed url if IRONIC_URL contains the API version as part of the URL

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

Bug Description

$ ironic --help

...

  --ironic-url IRONIC_URL
                        Defaults to env[IRONIC_URL]

stack@stack:~/devstack$ IRONIC_URL=http://127.0.0.1:6385/v1
stack@stack:~/devstack$ ironic --debug node-list
DEBUG (session:269) REQ: curl -i -X POST

....

 'User-Agent: python-ironicclient' http://127.0.0.1:6385/v1/v1/nodes

{"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"Invalid input for field/attribute chassis_uuid. Value: 'v1'. unable to convert to uuid\"}"}

WARNING (http:167) Request returned failure status.
Invalid input for field/attribute chassis_uuid. Value: 'v1'. unable to convert to uuid (HTTP 400)
stack@stack:~/devstack$

Note that if the API version (/v1) is specified as part of the endpoint's URL the client won't detect it and will append another /v1 in front of the URL when building it. E.g:

http://127.0.0.1:6385/v1/v1/node

WORKAROUND:

Don't put the api version as part of the endpoint

stack@stack:~/devstack$ IRONIC_URL=http://127.0.0.1:6385
stack@stack:~/devstack$ ironic node-list
+--------------------------------------+---------------+-------------+-----------------+-------------+
| uuid | instance_uuid | power_state | provision_state | maintenance |
+--------------------------------------+---------------+-------------+-----------------+-------------+
| 2566c730-072f-45f9-9437-808b1bc3b42b | None | power off | None | False |
| 12aa5621-14d8-4d29-969e-03f8e72ac20d | None | None | None | False |
+--------------------------------------+---------------+-------------+-----------------+-------------+
stack@stack:~/devstack$

Changed in python-ironicclient:
importance: Undecided → Medium
Dmitry Tantsur (divius)
Changed in python-ironicclient:
status: New → Triaged
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/107715

Changed in python-ironicclient:
assignee: nobody → Jim Rollenhagen (jim-rollenhagen)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

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

commit a07618e722969ca5b0c2b46670ff9d8170e54d5d
Author: Jim Rollenhagen <email address hidden>
Date: Thu Jul 17 07:04:30 2014 -0700

    Trim trailing slash and version from endpoint

    This commit removes trailing slashes and "/v1" from the endpoint
    given when initializing the HTTP client, in order to fix the bug
    mentioned below. It also removes the rstrip call in
    _make_connection_url, since this is done up front now.

    Also adds tests for get_connection_params.

    Change-Id: If2c2cd766466dca4621e8daa260575fd4f106f06
    Closes-Bug: #1342048

Changed in python-ironicclient:
status: In Progress → Fix Committed
Changed in python-ironicclient:
milestone: none → 0.7.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.