yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #08069
[Bug 1267530] [NEW] boolean query parameters inconsistently handled
Public bug reported:
The code which handles interpreting boolean query parameters (which are
always converted to strings as part of the request) seems overly
restrictive, it will only except "blah?parameter=0" as a definition of
False, and not the (arguably more intuitive) "blah?parameter=False"
For example, trying to use the domain "enabled" filter:
# curl -i -X GET -H 'X-Auth-Token: 27c9fcf8c0404de0b15f33e11208bdda' -H 'Content-Type: application/json' -H 'Accept: application/json' http://127.0.0.1:5000/v3/domains?enabled=0
HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 102
Date: Thu, 09 Jan 2014 16:37:29 GMT
{"domains": [], "links": {"self": "http://localhost:5000/v3/domains",
"previous": null, "next": null}}
# curl -i -X GET -H 'X-Auth-Token: 27c9fcf8c0404de0b15f33e11208bdd -H 'Content-Type: application/json' -H 'Accept: application/json' http://127.0.0.1:5000/v3/domains?enabled=False
HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 536
Date: Thu, 09 Jan 2014 16:37:35 GMT
{"domains": [{"links": {"self":
"http://localhost:5000/v3/domains/b10fcb438ed048ada48036c25f8a45de"},
"enabled": true, "description": "Owns users and tenants used by the heat
service", "name": "heat", "id": "b10fcb438ed048ada48036c25f8a45de"},
{"links": {"self": "http://localhost:5000/v3/domains/default"},
"enabled": true, "description": "Owns users and tenants (i.e. projects)
available on Identity API v2.", "name": "Default", "id": "default"}],
"links": {"self": "http://localhost:5000/v3/domains", "previous": null,
"next": null}}
So passing enabled=False returns all the results for enabled=True, which is, uh, confusing, particularly since True/False works when specifying enabled in the body when creating a domain.
The problem is here:
https://github.com/openstack/keystone/blob/master/keystone/common/controller.py#L321
** Affects: keystone
Importance: Undecided
Assignee: Steven Hardy (shardy)
Status: In Progress
** Changed in: keystone
Assignee: (unassigned) => Steven Hardy (shardy)
** Changed in: keystone
Status: New => In Progress
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1267530
Title:
boolean query parameters inconsistently handled
Status in OpenStack Identity (Keystone):
In Progress
Bug description:
The code which handles interpreting boolean query parameters (which
are always converted to strings as part of the request) seems overly
restrictive, it will only except "blah?parameter=0" as a definition of
False, and not the (arguably more intuitive) "blah?parameter=False"
For example, trying to use the domain "enabled" filter:
# curl -i -X GET -H 'X-Auth-Token: 27c9fcf8c0404de0b15f33e11208bdda' -H 'Content-Type: application/json' -H 'Accept: application/json' http://127.0.0.1:5000/v3/domains?enabled=0
HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 102
Date: Thu, 09 Jan 2014 16:37:29 GMT
{"domains": [], "links": {"self": "http://localhost:5000/v3/domains",
"previous": null, "next": null}}
# curl -i -X GET -H 'X-Auth-Token: 27c9fcf8c0404de0b15f33e11208bdd -H 'Content-Type: application/json' -H 'Accept: application/json' http://127.0.0.1:5000/v3/domains?enabled=False
HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 536
Date: Thu, 09 Jan 2014 16:37:35 GMT
{"domains": [{"links": {"self":
"http://localhost:5000/v3/domains/b10fcb438ed048ada48036c25f8a45de"},
"enabled": true, "description": "Owns users and tenants used by the
heat service", "name": "heat", "id":
"b10fcb438ed048ada48036c25f8a45de"}, {"links": {"self":
"http://localhost:5000/v3/domains/default"}, "enabled": true,
"description": "Owns users and tenants (i.e. projects) available on
Identity API v2.", "name": "Default", "id": "default"}], "links":
{"self": "http://localhost:5000/v3/domains", "previous": null, "next":
null}}
So passing enabled=False returns all the results for enabled=True, which is, uh, confusing, particularly since True/False works when specifying enabled in the body when creating a domain.
The problem is here:
https://github.com/openstack/keystone/blob/master/keystone/common/controller.py#L321
To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1267530/+subscriptions
Follow ups
References