support name and id in role,user,tenant query

Registered by LIU Yulong

If you create a role/user/tenant with a name that already exists, it will return a HTTP 409
e.g. Conflict occurred attempting to store user.
The name has uniqueness. This means that you can query a role/user/tenant with its name.

In python-keystoneclient support the name input query, it just find the item form the list if the name is in it.

python-keystoneclient user-get code:
@utils.arg('user', metavar='<user>', help='Name or ID of user to display.')
def do_user_get(kc, args):
    """Display user details."""
    user = utils.find_resource(kc.users, args.user)
    utils.print_dict(user._info)

The python-keystoneclient (role/user/tenant) resourceManager.get method was never called.

Then test keystone api call directly:

set user_id in the resource url:

curl -i -X GET http://xxxxxxx:35357/v2.0/users/e9f5188d12c043fdbbfec0cfa748d7b8 -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: ba38f0bdd3a74abfaf84dc884ebf5fc6"

HTTP/1.1 200 OK
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 138
Date: Wed, 07 Jan 2015 03:15:51 GMT

{"user": {"username": "admin", "name": "admin", "enabled": true, "email": "<email address hidden>", "id": "e9f5188d12c043fdbbfec0cfa748d7b8"}}

set username in the resource url:
curl -i -X GET http://xxxxxxx:35357/v2.0/users/admin -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: ba38f0bdd3a74abfaf84dc884ebf5fc6"

HTTP/1.1 404 Not Found
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 88
Date: Wed, 07 Jan 2015 03:16:02 GMT

{"error": {"message": "Could not find user, admin.", "code": 404, "title": "Not Found"}}

V3 api has the same result.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
LIU Yulong
Direction:
Needs approval
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Steve Martinelli

Related branches

Sprints

Whiteboard

(stevemar 16-02-02): i don't think this is something we want to pursue. not all backends (sql vs ldap) will create conflicts if the name matches, and different backend implementation each act differently.

the APIs are well-defined, the resource ID should be used to get the resource. sometimes the name happens to be unique for some resources, not always.

further, i am not clear on the use case that this feature will add. we offer listing resources with support for filtering by attributes (i.e. name), which many clients support.

further, this should go through the new spec proposal process at specs.openstack.org/openstack/keystone-specs

marking this as obsolete

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.