keystone-ldap TypeError: cannot concatenate 'str' and 'NoneType' object
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Undecided
|
Unassigned | |||
Ubuntu Cloud Archive |
Undecided
|
Unassigned | |||
Mitaka |
Undecided
|
Unassigned | |||
Ocata |
Undecided
|
Unassigned | |||
Pike |
Undecided
|
Unassigned | |||
Queens |
Undecided
|
Unassigned | |||
Rocky |
Undecided
|
Unassigned | |||
Stein |
Undecided
|
Unassigned | |||
keystone (Ubuntu) |
Undecided
|
Unassigned | |||
Xenial |
Undecided
|
Unassigned | |||
Bionic |
Undecided
|
Unassigned | |||
Cosmic |
Undecided
|
Unassigned | |||
Disco |
Undecided
|
Unassigned |
Bug Description
Proposed action:
=============
Key / value failed check error.
Should check key exists and warn user of bad users / continue
Bug presented by:
=================
openstack user list --domain customerdata
cannot concatenate 'str' and 'NoneType' objects (HTTP 400) (Request-ID: req-cc0e225d-
Trace:
======
(keystone.
Traceback (most recent call last):
File "/usr/lib/
result = method(req, **params)
File "/usr/lib/
return f(self, request, filters, **kwargs)
File "/usr/lib/
return UserV3.
File "/usr/lib/
cls.
File "/usr/lib/
cls.
File "/usr/lib/
ref[
TypeError: cannot concatenate 'str' and 'NoneType' objects
Offending Data:
===============
@ line 233 i put LOG.debug( pprint.pformat( refs ) )
grep -b 2 "'id': None," /varlog/
{'domain_id': u'8ce102de5ac64
'email': <email address hidden>',
'id': None,
--
{'domain_id': u'8ce102de5ac64
'email': <email address hidden>',
'id': None,
--
{'domain_id': u'8ce102de5ac64
'email': <email address hidden>',
'id': None,
Platform:
=========
cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://
SUPPORT_URL="http://
BUG_REPORT_URL="http://
VERSION_
UBUNTU_
verions:
========
dpkg --list | grep keystone
ii keystone 2:11.0.
ii python-keystone 2:11.0.
ii python-
ii python-
ii python-
description: | updated |
affects: | keystone → keystone (Ubuntu) |
Corey Bryant (corey.bryant) wrote : | #1 |
Corey Bryant (corey.bryant) wrote : | #2 |
David, just to be clear, is this an issue where the specified domain in 'openstack user list --domain customerdata' does not exist and it should fail gracefully rather than with a traceback? Also it seems that this is not LDAP specific, but please correct me if I'm wrong. I'm deploying stein to see if it recreates there.
Corey Bryant (corey.bryant) wrote : | #3 |
I'm not able to recreate this on stein (that is, assuming I understand the problem correctly).
$ openstack domain list
+------
| ID | Name | Enabled | Description |
+------
| 36bc721906cc453
| 58e8c54b7ae84ef
| 66d858a41571421
| 7cae5f364e91496
+------
$ openstack user list --domain admin_domain
+------
| ID | Name |
+------
| 4f224c0a4f634a5
| 7d626e7ff5a74cc
| e6d1b35119fc443
+------
$ openstack user list --domain does_not_exist
No domain with a name or ID of 'does_not_exist' exists.
Alok G Singh (alephnull-b) wrote : | #4 |
Corey, the problem here is the fact that there are users in LDAP with None as id. The existence of a one such user causes `openstack user list --domain dom0` to fail with the error:
TypeError: cannot concatenate 'str' and 'NoneType' objects
HTH.
Corey Bryant (corey.bryant) wrote : | #5 |
Thanks Alok. Do you have a work around for this? I'm assuming users with id=None are invalid, but obviously failing to list users is an issue and keystone should be handling that scenario.
Corey Bryant (corey.bryant) wrote : | #6 |
Here's a patch to force this failure to occur on Queens:
From 9ef61915093d889
From: Corey Bryant <email address hidden>
Date: Tue, 12 Mar 2019 17:07:04 -0400
Subject: [PATCH] First list_users() to fail due to id=None on Queens
Change-Id: I5516817d053d4c
---
keystone/
1 file changed, 1 insertion(+)
diff --git a/keystone/
index da0f1aecb.
--- a/keystone/
+++ b/keystone/
@@ -70,6 +70,7 @@ class UserV3(
refs = PROVIDERS.
)
+ refs[0]['id'] = None
return UserV3.
@controlle
--
2.20.1
Alok G Singh (alephnull-b) wrote : | #7 |
@Corey, we have no workaround for this error.
Colleen Murphy (krinkle) wrote : | #8 |
Is this confirmed for Stein or only for Queens?
Drew Freiberger (afreiberger) wrote : | #9 |
This is only confirmed on xenial Ocata.
When querying the domain, as it loops through users returned from the all user query of LDAP, it tries to create mappings in keystone for any new users.
https:/
This hits the method keystone.
it then tries to fall back to querying the public_id of the existing local_entity which doesn't exist and hence returns None. However, if it would just return that public_id that just tossed as duplicate from this line, it could work around the issue.
This is the duplicate being detected, why not just return that duplicate ID rather than having to return a reverse lookup of a potentially non-existent object.
Basically, this customer deletes entries from LDAP, then we delete them from the local_users and users tables, and sometimes forget to remove from id_mappings table as well. This is done manually because there's no way to delete a keystone user w/out the user existing in the ldap backend still. (best practice being to disable the user's accountActive flag and leave them in LDAP)
So, operator error working around one bug is creating what appears to be a new bug when the ldap user is recreated.
When we query the id_mappings table, we found 402 entries in id_mapping table that don't belong to the domain any longer in nonlocal_users table or users table. So, these 402 entries could not be re-created as new ldap users.
To reproduce:
create LDAP domain with user foo and query openstack domain so user foo gets a user entry in keystone.
remove user foo from user and nonlocal_user table in mysql database, leaving entry in id_mappings table.
Try to query domain (openstack user list --domain <ldapdom>), user foo should cause a traceback when it tries to recreate the id_mapping.
Ultimately, I believe we have to cleanup the id_mappings table, however, I believe the invalid assumption at the line below is still worth discussion:
https:/
Drew Freiberger (afreiberger) wrote : | #10 |
Here's a query I used to determine we have entries in id_mapping table that don't have a matching local_entity in the user/nonlocal_user tables.
select * from id_mapping where public_id not in (select id_mapping.
tags: | added: sts |
Changed in keystone (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → High |
Corey Bryant (corey.bryant) wrote : | #11 |
@Colleen, I didn't get around to confirming on stein. The code seems to have changed around enough for the recreate patch above to not work.
Corey Bryant (corey.bryant) wrote : | #12 |
s/not to work/not to apply
Corey Bryant (corey.bryant) wrote : | #13 |
Sorry I triaged the wrong bug. I'll just mark this as triaged for ocata for now until I, or someone else, has more time to look at other releases.
Corey Bryant (corey.bryant) wrote : | #14 |
I mean queens.
Changed in keystone (Ubuntu): | |
status: | Triaged → New |
importance: | High → Undecided |
Changed in keystone (Ubuntu Bionic): | |
importance: | Undecided → High |
status: | New → Triaged |
Colleen Murphy (krinkle) wrote : | #15 |
I can't reproduce this either on Stein or Queens with devstack. Haven't tried with Ocata yet. This is what I tried:
Create new user in LDAP backend:
$ ldapadd -x -w nomoresecret -D cn=Manager,
> -H ldap://localhost -c -f peter.ldif.in
adding new entry "cn=peter,
$ openstack --os-cloud=
+------
| ID | Name |
+------
| eb55ea06af4ba6f
| fbbc3741707c62d
+------
Auth with the user so that an entry gets created in the user and nonlocal_user database:
$ openstack --os-cloud=ldap token issue
...
Delete the user from the LDAP backend:
$ ldapdelete -x -w nomoresecret -D cn=Manager,
> -H ldap://localhost cn=peter,
At this point from the API perspective the user is effectively gone:
$ openstack --os-cloud=
+------
| ID | Name |
+------
| eb55ea06af4ba6f
+------
Manually removed the user from the mysql database:
mysql> delete from user where id = 'fbbc3741707c62
Query OK, 1 row affected (0.01 sec)
mysql> select * from nonlocal_user;
Empty set (0.00 sec)
User list still seems okay:
$ openstack --os-cloud=
+------
| ID | Name |
+------
| eb55ea06af4ba6f
+------
$ sudo systemctl restart memcached
$ openstack --os-cloud=
+------
| ID | Name |
+------
| eb55ea06af4ba6f
+------
Two other comments:
First, in my opinion, manually editing the database table is not supportable. Keystone's behavior after doing that is naturally undefined.
Second, regarding this comment:
> Ultimately, I believe we have to cleanup the id_mappings table, however, I believe the invalid assumption at the line below is s...
Changed in keystone (Ubuntu Bionic): | |
importance: | High → Undecided |
status: | Triaged → New |
Colleen Murphy (krinkle) wrote : | #16 |
Is there any update with regard to my comment https:/
Changed in keystone: | |
status: | New → Incomplete |
Changed in keystone (Ubuntu Disco): | |
status: | New → Won't Fix |
Note that 11.0.3 is Ocata. We do have an 11.0.4 package version available. First thing I'd like to check is to see if this is fixed in either 11.0.4 or a future keystone release.