I have an OpenStack cloud connected to LDAP (of which I have no control and doesn't return the matching case when I query) where Keystone has the user as 'UserNaMe' and if I search for a user with this code, the id is returned:
conn = openstack.connect(cloud)
pprint(conn.identity.find_user('UserNaMe'))
However, if I search for a username without the proper case, no id is returned:
pprint(conn.identity.find_user('username'))
Since the https://docs.openstack.org/openstacksdk/latest/user/proxies/identity_v3.html#user-operations documentation is not specific, how do I make the search case insensitive so that I always get the correct user id?
Horizon seems to have no issue with 'username' instead of 'UserNaMe', so there must be a way to search insensitively.
One option would be to inspect the Horizon source and see how it handles the user search.
Another option would be to iterate over the list of users and perform case-insensitive comparisons. E.g.:
want_user = 'UserNaMe'
found_user = [user for user in conn.identity.users()
if user.name.lower() == want_user.lower()]