← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1597024] [NEW] List role_assignments?include_names=False returns Entitys' Names

 

Public bug reported:

When include_names=True, it shows the expected results that is with all
the names in additional to Ids. However, it makes no difference when
include_names=False. Like the following -

------------------------------------------------------------------------------------
GET https://localhost:35357/v3/role_assignments?user.id=44dfc2bd8f254a068d43e102a89fc355&include_names=False HTTP/1.1
Accept-Encoding: gzip,deflate
X-Auth-Token: bee62e952fba4bafb09ad73cdc968eca
Accept: application/json
Host: localhost:35357
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

HTTP/1.1 200 OK
Date: Thu, 02 Jun 2016 19:53:17 GMT
Server: Apache/2.4.10 (Debian)
Vary: X-Auth-Token
x-openstack-request-id: req-37962d1f-5d31-4d91-b8c3-1c598be4c82c
Content-Length: 765
Content-Type: application/json

{"role_assignments": [{"scope": {"domain": {"id":
"b4421df800714f33ae9cdcd37704a98e", "name":
"domainname_91455-201606021353160180"}}, "role": {"id":
"2d3797efdb684f57b35e63eb7f66b30c", "name":
"update_Role_91455-201606021353160180"}, "user": {"domain": {"id":
"b4421df800714f33ae9cdcd37704a98e", "name":
"domainname_91455-201606021353160180"}, "id":
"44dfc2bd8f254a068d43e102a89fc355", "name":
"DAname_91455-201606021353160180"}, "links": {"assignment":
"https://localhost:35357/v3/domains/b4421df800714f33ae9cdcd37704a98e/users/44dfc2bd8f254a068d43e102a89fc355/roles/2d3797efdb684f57b35e63eb7f66b30c"}}],
"links": {"self":
"https://localhost:35357/v3/role_assignments?user.id=44dfc2bd8f254a068d43e102a89fc355&include_names=False";,
"previous": null, "next": null}}

------------------------------------------------------------------------------------

The workaround is to not specify include_names or set include_names=0.

A bug is in the parser.

There is a parser 'def query_filter_is_true(cls, filter_value):' defined in common/controller.py returns False when filter_value is 0; anything else return True. Like -
if (isinstance(filter_value, six.string_types) and filter_value == '0'):
    val = False
else:
    val = True

So basically it just does not consider value of filter_value False is
False, only 0.

** Affects: keystone
     Importance: Undecided
     Assignee: Sam Leong (chio-fai-sam-leong)
         Status: New

** Changed in: keystone
     Assignee: (unassigned) => Sam Leong (chio-fai-sam-leong)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1597024

Title:
  List role_assignments?include_names=False returns Entitys' Names

Status in OpenStack Identity (keystone):
  New

Bug description:
  When include_names=True, it shows the expected results that is with
  all the names in additional to Ids. However, it makes no difference
  when include_names=False. Like the following -

  ------------------------------------------------------------------------------------
  GET https://localhost:35357/v3/role_assignments?user.id=44dfc2bd8f254a068d43e102a89fc355&include_names=False HTTP/1.1
  Accept-Encoding: gzip,deflate
  X-Auth-Token: bee62e952fba4bafb09ad73cdc968eca
  Accept: application/json
  Host: localhost:35357
  Connection: Keep-Alive
  User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

  HTTP/1.1 200 OK
  Date: Thu, 02 Jun 2016 19:53:17 GMT
  Server: Apache/2.4.10 (Debian)
  Vary: X-Auth-Token
  x-openstack-request-id: req-37962d1f-5d31-4d91-b8c3-1c598be4c82c
  Content-Length: 765
  Content-Type: application/json

  {"role_assignments": [{"scope": {"domain": {"id":
  "b4421df800714f33ae9cdcd37704a98e", "name":
  "domainname_91455-201606021353160180"}}, "role": {"id":
  "2d3797efdb684f57b35e63eb7f66b30c", "name":
  "update_Role_91455-201606021353160180"}, "user": {"domain": {"id":
  "b4421df800714f33ae9cdcd37704a98e", "name":
  "domainname_91455-201606021353160180"}, "id":
  "44dfc2bd8f254a068d43e102a89fc355", "name":
  "DAname_91455-201606021353160180"}, "links": {"assignment":
  "https://localhost:35357/v3/domains/b4421df800714f33ae9cdcd37704a98e/users/44dfc2bd8f254a068d43e102a89fc355/roles/2d3797efdb684f57b35e63eb7f66b30c"}}],
  "links": {"self":
  "https://localhost:35357/v3/role_assignments?user.id=44dfc2bd8f254a068d43e102a89fc355&include_names=False";,
  "previous": null, "next": null}}

  ------------------------------------------------------------------------------------

  The workaround is to not specify include_names or set include_names=0.

  A bug is in the parser.

  There is a parser 'def query_filter_is_true(cls, filter_value):' defined in common/controller.py returns False when filter_value is 0; anything else return True. Like -
  if (isinstance(filter_value, six.string_types) and filter_value == '0'):
      val = False
  else:
      val = True

  So basically it just does not consider value of filter_value False is
  False, only 0.

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1597024/+subscriptions


Follow ups