keystone/keystone/identity
Colleen Murphy fb81469404 Delete SQL users before deleting domain
Since the users table has a foreign key to the projects table[1], users
must be deleted before the domain can be deleted. However, the
notification emitted from the domain deletion comes too late, and
keystone runs into a foreign key reference error before it can delete
the users. This patch addresses the problem by adding a new internal
notification to alert the identity manager that users should be deleted.
This uses a new notification rather than the existing notification
because the existing one is used to alert listeners that the domain
deletion has been fully completed, whereas this one must happen in the
middle of the domain delete process.

The callback must also only try to delete SQL users. The LDAP driver
doesn't support deleting users, and we can't assume other drivers
support it either. Moreover, the foreign key reference is only a problem
for SQL users anyway.

Because our backend unit tests run with SQLite and foreign keys do not
work properly, we can't properly expose this bug in our unit tests, but
there is an accompanying tempest test[2][3] to validate this fix.

[1] https://github.com/openstack/keystone/blob/2bd88d3/keystone/common/sql/expand_repo/versions/014_expand_add_domain_id_to_user_table.py#L140-L141
[2] https://review.openstack.org/#/c/509610
[3] https://review.openstack.org/#/c/509947

Change-Id: If5bdb6f5eef80b50b000aed5188ce7da4dfd1083
Closes-bug: #1718747
(cherry picked from commit 62ee18b359)
2018-02-09 00:19:33 +01:00
..
backends Filter users/groups in ldap with whitespaces 2017-11-15 01:09:18 +00:00
id_generators Replace six iteration methods with standard ones 2016-09-08 18:56:31 +08:00
mapping_backends Merge "Faster id mapping lookup" 2016-11-01 00:08:36 +00:00
shadow_backends Set the domain for federated users 2017-01-25 22:03:52 +00:00
__init__.py Remove exposure of routers at package level 2015-12-03 15:06:56 -03:00
controllers.py Remove log translations in keystone 2017-03-25 18:17:15 +00:00
core.py Delete SQL users before deleting domain 2018-02-09 00:19:33 +01:00
generator.py Replace keystone.common.config with keystone.conf package 2016-06-24 17:02:15 +00:00
routers.py Implement HEAD method for all v3 GET actions 2016-03-22 10:27:53 -07:00
schema.py Implement better validation for resource options 2017-01-29 13:19:44 -08:00