Comment 6 for bug 1392035

Revision history for this message
Alexey Miroshkin (amirosh) wrote :

It looks like client problem and not a keystone server one.

All mysql tables uses utf8_general_ci, so all string operations are case insensitive. It's why you get

user create stevenk
ERROR: openstack Conflict occurred attempting to store user - Duplicate Entry (HTTP 409)

for mysql values are identical:

mysql> select * from user where name='Newuser';
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+
| id | name | extra | password | enabled | domain_id | default_project_id |
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+
| 66433a960fbd44599e1f4cccfd6489a8 | Newuser | {"email": null} | NULL | 1 | default | NULL |
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+
1 row in set (0.00 sec)

mysql> select * from user where name='newuser';
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+
| id | name | extra | password | enabled | domain_id | default_project_id |
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+
| 66433a960fbd44599e1f4cccfd6489a8 | Newuser | {"email": null} | NULL | 1 | default | NULL |
+----------------------------------+---------+-----------------+----------+---------+-----------+--------------------+

However 'user show' command is very interesting. It treats the parameter as user ID and calls keystone's get_user(id). When name is used it returns NotFound. So then client invokes get_users() without any filters, gets list of all users and parses it locally to find a match. It's a reason why show command is case sensitive, because it has nothing to do with mysql collation.

Note - there is an interesting comment:

@controller.v2_deprecated
    def get_users(self, context):
        # NOTE(termie): i can't imagine that this really wants all the data
        # about every single user in the system...

however 'user show' uses it heavily.