neutron client's curl command does not work with query string

Bug #1255912 reported by yong sheng gong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Invalid
Medium
yong sheng gong

Bug Description

currently, run neutron -v network-list to show the curl commands. the curl command which has query string in its url will fail.
curl -i http://172.16.108.1:9696/v2.0/subnets.json?fields=id&fields=cidr&id=160b5bba-3910-48f0-bbd3-85da2fd06b14&id=8ae28784-fc5c-40c5-a57b-398ad61d4fce -X GET -H "X-Auth-Token: 580c3a4e951b41da94871cc22cd2c231" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"
[1] 12439
[2] 12440
[3] 12441
HTTP/1.1 401 Unauthorized
Www-Authenticate: Keystone uri='http://172.16.108.1:35357'
Content-Type: text/plain
Content-Length: 23
Date: Thu, 28 Nov 2013 10:04:38 GMT

Authentication required-X: command not found
[2]- Done fields=cidr
[1] Done curl -i http://172.16.108.1:9696/v2.0/subnets.json?fields=id
[2]- Done fields=cidr
[3]+ Done id=160b5bba-3910-48f0-bbd3-85da2fd06b14

but if we enclose the url with double quotes, it works:

gongysh@gongysh-ThinkPad-T530:~/devstack$ curl -i "http://172.16.108.1:9696/v2.0/subnets.json?fields=id&fields=cidr&id=160b5bba-3910-48f0-bbd3-85da2fd06b14&id=8ae28784-fc5c-40c5-a57b-398ad61d4fce" -X GET -H "X-Auth-Token: 580c3a4e951b41da94871cc22cd2c231" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 159
Date: Thu, 28 Nov 2013 10:07:53 GMT

{"subnets": [{"cidr": "10.0.0.0/24", "id": "160b5bba-3910-48f0-bbd3-85da2fd06b14"}, {"cidr": "192.168.30.0/24", "id": "8ae28784-fc5c-40c5-a57b-398ad61d4fce"}]}

affects: neutron → python-neutronclient
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

Changed in python-neutronclient:
status: New → In Progress
Revision history for this message
Akihiro Motoki (amotoki) wrote :

ubuntu@dev16:~$ neutron -v subnet-list -F id -F cidr --id 5b7ef5ce-df82-4c73-b480-29aacdf4d22e
DEBUG: neutronclient.neutron.v2_0.subnet.ListSubnet get_data(Namespace(columns=[], fields=[u'id', u'cidr'], formatter='table', max_width=0, noindent=False, page_size=None, quote_mode='nonnumeric', request_format='json', show_details=False, sort_dir=[], sort_key=[]))
DEBUG: keystoneauth.session REQ: curl -g -i -X GET http://172.16.18.47:5000 -H "Accept: application/json" -H "User-Agent: keystoneauth1"
DEBUG: keystoneauth.session RESP: [300] Content-Length: 593 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.7 (Ubuntu) Connection: Keep-Alive Date: Thu, 03 Dec 2015 22:03:01 GMT Content-Type: application/json
RESP BODY: {"versions": {"values": [{"status": "stable", "updated": "2015-03-30T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}], "id": "v3.4", "links": [{"href": "http://172.16.18.47:5000/v3/", "rel": "self"}]}, {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://172.16.18.47:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}]}}

DEBUG: keystoneauth.identity.v3.base Making authentication request to http://172.16.18.47:5000/v3/auth/tokens
DEBUG: keystoneauth.session REQ: curl -g -i -X GET http://172.16.18.47:9696/v2.0/subnets.json?fields=id&fields=cidr&id=5b7ef5ce-df82-4c73-b480-29aacdf4d22e -H "User-Agent: python-neutronclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}4dee082a964002e4ea37939768f6986cd654d4ba"
DEBUG: keystoneauth.session RESP: [200] Date: Thu, 03 Dec 2015 22:03:01 GMT Connection: keep-alive Content-Type: application/json; charset=UTF-8 Content-Length: 89 X-Openstack-Request-Id: req-f4175420-34f6-453c-a9f5-02b13eef10fb
RESP BODY: {"subnets": [{"cidr": "192.168.100.0/24", "id": "5b7ef5ce-df82-4c73-b480-29aacdf4d22e"}]}

+--------------------------------------+------------------+
| id | cidr |
+--------------------------------------+------------------+
| 5b7ef5ce-df82-4c73-b480-29aacdf4d22e | 192.168.100.0/24 |
+--------------------------------------+------------------+

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Based on the above test, it works now (Dec 2015).

Changed in python-neutronclient:
status: In Progress → Invalid
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.