List users in a group by name throws HTTP 500 error

Bug #1521772 reported by Haneef Ali on 2015-12-01
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Medium
Ankit Agrawal
Liberty
Medium
Steve Martinelli

Bug Description

(keystone.common.wsgi): 2015-12-01 21:53:58,603 INFO wsgi __call__ GET http://192.168.245.9:35357/v3/groups/42b6bb3bb70f487cbf9633bf55eb9ddc/users?name=admin
(keystone.common.wsgi): 2015-12-01 21:53:58,610 ERROR wsgi __call__ Entity '<class 'keystone.identity.backends.sql.UserGroupMembership'>' has no property 'name'
Traceback (most recent call last):
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/common/wsgi.py", line 248, in __call__
    result = method(context, **params)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/common/controller.py", line 207, in wrapper
    return f(self, context, filters, **kwargs)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/identity/controllers.py", line 233, in list_users_in_group
    refs = self.identity_api.list_users_in_group(group_id, hints=hints)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/common/manager.py", line 58, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/identity/core.py", line 433, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/identity/core.py", line 444, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/identity/core.py", line 1123, in list_users_in_group
    ref_list = driver.list_users_in_group(entity_id, hints)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/identity/backends/sql.py", line 226, in list_users_in_group
    query = sql.filter_limit_query(User, query, hints)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/common/sql/core.py", line 410, in filter_limit_query
    query = _filter(model, query, hints)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/keystone/common/sql/core.py", line 362, in _filter
    query = query.filter_by(**filter_dict)
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1345, in filter_by
    for key, value in kwargs.items()]
  File "/opt/stack/service/keystone/venv/lib/python2.7/site-packages/sqlalchemy/orm/base.py", line 383, in _entity_descriptor
    (description, key)
InvalidRequestError: Entity '<class 'keystone.identity.backends.sql.UserGroupMembership'>' has no property 'name'

Steve Martinelli (stevemar) wrote :

single backend? sql backend? via CLI or python bindings?

a stacktrace is hard to reproduce

Haneef Ali (haneef) wrote :

SQL Backend and just curl . This is from liberty stable

curl -H "X-Auth-Token:$token" http://192.168.245.9:35357/v3/groups/42b6bb3bb70f487cbf9633bf55eb9ddc/users?name=admin

Changed in keystone:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
Changed in keystone:
status: New → Confirmed
Lance Bragstad (lbragstad) wrote :

I was able to reproduce this with master [0].

[0] http://cdn.pasteraw.com/rc6zswrvabf0bxxs7rkmwtrdqv55p4i

tags: added: liberty-backport-potential

I have also tried to reproduce and found that listing of users in group fails also by domain_id and description too.

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

Changed in keystone:
assignee: Abhishek Kekane (abhishek-kekane) → Ankit Agrawal (ankitagrawal)
status: Confirmed → In Progress
Changed in keystone:
milestone: none → mitaka-2
importance: Undecided → Medium

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

Reviewed: https://review.openstack.org/264779
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=545987e1c4d451832b2d6c069874a11ae0bc6347
Submitter: Jenkins
Branch: master

commit 545987e1c4d451832b2d6c069874a11ae0bc6347
Author: Ankit Agrawal <email address hidden>
Date: Thu Jan 7 05:29:06 2016 -0800

    Expose defect in users_in_group, groups_for_user exact filters

    List users in a group by name and list groups for user by name throws
    HTTP 500 error in case of exact filters because filter_by query used
    in case of exact filter is not able to filter using 'name' attribute.
    This patch exposes this issue by adding new unit test cases to ensure
    list_users_in_group and list_groups_for_user APIs are called with
    exact filters.

    Partial-Bug: 1521772
    Change-Id: I5d3c2041551a020341a98554ebb885888ec3cc9d

Changed in keystone:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/263158
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=ee2859a61a0df6636c1c33601d8f3c309f8e6281
Submitter: Jenkins
Branch: master

commit ee2859a61a0df6636c1c33601d8f3c309f8e6281
Author: Ankit Agrawal <email address hidden>
Date: Thu Jan 7 05:55:38 2016 -0800

    Fix users in group and groups for user exact filters

    List users in a group by name and list groups for user by name
    throws HTTP 500 error in case of exact filters because filter_by
    query used in case of exact filter is not able to filter using
    'name' attribute.
    This patch fixes this issue by replacing filter_by with filter query
    in case of exact_filter similar to the inexact_filter query.

    Closes-Bug: 1521772
    Change-Id: Ib44513540370c0701a439f11a49e0dc338601fae

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/265236

Reviewed: https://review.openstack.org/265177
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=be3160d165c28657534974d5ad9dbebc4254604d
Submitter: Jenkins
Branch: stable/liberty

commit be3160d165c28657534974d5ad9dbebc4254604d
Author: Ankit Agrawal <email address hidden>
Date: Thu Jan 7 05:29:06 2016 -0800

    Expose defect in users_in_group, groups_for_user exact filters

    List users in a group by name and list groups for user by name throws
    HTTP 500 error in case of exact filters because filter_by query used
    in case of exact filter is not able to filter using 'name' attribute.
    This patch exposes this issue by adding new unit test cases to ensure
    list_users_in_group and list_groups_for_user APIs are called with
    exact filters.

    Note: Added 'from keystone.tests.unit.utils import wip' in
    test_backend_ldap.py, because 'wip' is not there in
    test_backend_ldap imports in stable-liberty.

    Conflicts:
            keystone/tests/unit/test_backend.py

    Partial-Bug: 1521772
    Change-Id: I5d3c2041551a020341a98554ebb885888ec3cc9d
    (cherry picked from commit 545987e1c4d451832b2d6c069874a11ae0bc6347)

tags: added: in-stable-liberty

Reviewed: https://review.openstack.org/265236
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=016efe0e5958fcabb2bdf760b9f21bc2b2354011
Submitter: Jenkins
Branch: stable/liberty

commit 016efe0e5958fcabb2bdf760b9f21bc2b2354011
Author: Ankit Agrawal <email address hidden>
Date: Thu Jan 7 05:55:38 2016 -0800

    Fix users in group and groups for user exact filters

    List users in a group by name and list groups for user by name
    throws HTTP 500 error in case of exact filters because filter_by
    query used in case of exact filter is not able to filter using
    'name' attribute.
    This patch fixes this issue by replacing filter_by with filter query
    in case of exact_filter similar to the inexact_filter query.

    Closes-Bug: 1521772
    Change-Id: Ib44513540370c0701a439f11a49e0dc338601fae
    (cherry picked from commit ee2859a61a0df6636c1c33601d8f3c309f8e6281)

This issue was fixed in the openstack/keystone 9.0.0.0b2 development milestone.

This issue was fixed in the openstack/keystone 8.1.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers