keystone/keystone
Colleen Murphy 62ee18b359 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
2018-02-08 21:19:02 +01:00
..
application_credential Add cache invalidation when delete application credential 2018-02-05 14:09:07 +08:00
assignment Remove all v2.0 APIs except the ec2tokens API 2018-02-06 23:12:55 +01:00
auth Use keystone.common.provider_api for auth APIs 2018-02-02 22:07:29 +00:00
catalog Use keystone.common.provider_api for catalog APIs 2017-12-27 16:32:18 +00:00
cmd Merge "Rename fernet_utils to token_utils" 2018-01-16 13:48:28 +00:00
common Merge "Add scope_types to role policies" 2018-02-07 06:03:46 +00:00
conf Merge "Impose limits on application credentials" 2018-01-31 22:16:25 +00:00
contrib Remove all v2.0 APIs except the ec2tokens API 2018-02-06 23:12:55 +01:00
credential Merge "Rename fernet_utils to token_utils" 2018-01-16 13:48:28 +00:00
endpoint_policy Use keystone.common.provider_api for endpoint_policy APIs 2017-12-27 16:56:49 +00:00
federation Merge "Remove all v2.0 APIs except the ec2tokens API" 2018-02-07 09:01:26 +00:00
identity Delete SQL users before deleting domain 2018-02-08 21:19:02 +01:00
limit Expose unified limit APIs 2018-01-25 16:33:11 +08:00
locale Imported Translations from Zanata 2018-01-13 06:29:16 +00:00
middleware Implement system-scoped tokens 2018-01-23 23:33:43 +00:00
models Implement system-scoped tokens 2018-01-23 23:33:43 +00:00
oauth1 Remove all v2.0 APIs except the ec2tokens API 2018-02-06 23:12:55 +01:00
policy Use keystone.common.provider_api for policy APIs 2017-12-27 17:10:20 +00:00
resource Delete SQL users before deleting domain 2018-02-08 21:19:02 +01:00
revoke Remove all v2.0 APIs except the ec2tokens API 2018-02-06 23:12:55 +01:00
server Add limit provider 2018-01-25 15:45:44 +08:00
tests Merge "Fix list users by name" 2018-02-07 15:41:37 +00:00
token Merge "Remove all v2.0 APIs except the ec2tokens API" 2018-02-07 09:01:26 +00:00
trust Add application credential auth plugin 2018-01-27 12:00:19 +01:00
version Remove all v2.0 APIs except the ec2tokens API 2018-02-06 23:12:55 +01:00
__init__.py Revert "Disable eventlet monkey-patching of DNS" 2013-05-10 10:24:48 -04:00
exception.py Impose limits on application credentials 2018-01-27 12:00:23 +01:00
i18n.py Update links in keystone 2017-09-12 15:18:13 +08:00
notifications.py Delete SQL users before deleting domain 2018-02-08 21:19:02 +01:00