keystone/keystone
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
..
assignment Cache list projects and domains for user 2017-08-09 14:45:58 +00:00
auth Merge "Add annotation about token authenticate" 2017-06-23 21:31:03 +00:00
catalog Ensure the endpoint filter API supports HEAD 2017-06-13 14:03:14 +00:00
cmd Add a hacking rule for string interpolation at logging 2017-07-18 14:11:28 +08:00
common Add int storage of datetime for password created/expires 2017-08-15 18:34:20 +00:00
conf Resource backend is SQL only now 2017-08-14 19:00:37 +00:00
contrib Fix ec2tokens validation in v2 after regression in metadata_ref removal 2017-07-28 16:20:53 +02:00
credential Merge "Make use of Dict-base including extras explicit" 2017-03-31 20:11:14 +00:00
endpoint_policy Ensure the endpoint policy API supports HEAD 2017-06-20 19:44:43 +00:00
federation Handle auto-generated domains when creating IdPs 2017-07-27 20:20:00 +00:00
identity Delete SQL users before deleting domain 2018-02-09 00:19:33 +01:00
locale Imported Translations from Zanata 2017-08-02 07:49:09 +00:00
middleware Make an error state message more explicit 2017-08-08 14:53:20 -07:00
models Revert change 438035 is_admin_project default 2017-05-11 10:46:03 -04:00
oauth1 Ensure oauth API supports HEAD 2017-06-21 15:00:38 +00:00
policy Remove unused CONF 2017-04-22 15:22:05 +08:00
resource Delete SQL users before deleting domain 2018-02-09 00:19:33 +01:00
revoke Remove unused revoke_by_domain_role_assignment 2017-03-24 15:22:04 +00:00
server Merge "Remove log translations in keystone" 2017-03-27 17:35:03 +00:00
tests Filter users/groups in ldap with whitespaces 2017-11-15 01:09:18 +00:00
token Remove duplicate roles from federated auth 2017-08-16 15:22:36 +00:00
trust Merge "Ensure the trust API supports HEAD requests" 2017-06-23 05:23:13 +00:00
v2_crud Use https for docs.openstack.org references 2017-01-30 16:05:08 -08:00
version Remove log translations in keystone 2017-03-25 18:17:15 +00:00
__init__.py Revert "Disable eventlet monkey-patching of DNS" 2013-05-10 10:24:48 -04:00
exception.py Handle ldap size limit exeeded exception 2017-10-25 02:06:08 +00:00
i18n.py Remove log translations in keystone 2017-03-25 18:17:15 +00:00
notifications.py Delete SQL users before deleting domain 2018-02-09 00:19:33 +01:00