mirror of
https://github.com/ansible/awx.git
synced 2026-08-02 10:59:56 -02:30
Allow deleting org of a running workflow job (#15374)
Old RBAC system hits DOESNOTEXIST query errors if a user deletes an org while a workflow job is active. The error is triggered by 1. starting workflow job 2. delete the org that the workflow job is a part of 3. The workflow changes status (e.g. pending to waiting) This error message would surface awx.main.models.rbac.Role.DoesNotExist: Role matching query does not exist. The fix is wrap the query in a try catch, and skip over some logic if the roles don't exist. --------- Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
@@ -689,9 +689,15 @@ def sync_parents_to_new_rbac(instance, action, model, pk_set, reverse, **kwargs)
|
||||
|
||||
for role_id in pk_set:
|
||||
if reverse:
|
||||
child_role = Role.objects.get(id=role_id)
|
||||
try:
|
||||
child_role = Role.objects.get(id=role_id)
|
||||
except Role.DoesNotExist:
|
||||
continue
|
||||
else:
|
||||
parent_role = Role.objects.get(id=role_id)
|
||||
try:
|
||||
parent_role = Role.objects.get(id=role_id)
|
||||
except Role.DoesNotExist:
|
||||
continue
|
||||
|
||||
# To a fault, we want to avoid running this if triggered from implicit_parents management
|
||||
# we only want to do anything if we know for sure this is a non-implicit team role
|
||||
|
||||
Reference in New Issue
Block a user