Work around potential double row.delete() call

The update_acls code can potentially iterate over the same ACL
twice. This temporary workaround silently ignores an attempt to
delete the same row twice in the same transaction, since that
should be safe. Ultimately, refactoring the ACL code to use sets
and possibly handle the fact that an ACL could be referenced from
multiple rows should be done.

Change-Id: I895eaf4006583fedc2657a4eb527df1ff992c5bc
Related-bug: #1857016
This commit is contained in:
Terry Wilson 2019-12-19 09:17:50 -06:00
parent 858d7f3395
commit 474bff078c
1 changed files with 5 additions and 1 deletions

View File

@ -630,7 +630,11 @@ class UpdateACLsCommand(command.BaseCommand):
# Delete old ACLs.
if acl_del_objs:
for acl_del_obj in acl_del_objs:
acl_del_obj.delete()
try:
acl_del_obj.delete()
except AssertionError:
# If we try to delete a row twice, just continue
pass
# Add new ACLs.
acl_add_objs = None