From 81f093b1c09528961c2fdf5e5b3458a9ae8689dc Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Tue, 24 May 2016 12:46:43 -0400 Subject: [PATCH] Opt to rebuild all roles in helper method This code was fine for the 0009 migrations since we introduced all roles at once, however with changes in 0017 we can't just patch from the roots, so this works generically without having to get fancy about identifying which roles we need to actually update. --- awx/main/migrations/_rbac.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/awx/main/migrations/_rbac.py b/awx/main/migrations/_rbac.py index beabcf7c1d..c45b1ba5b1 100644 --- a/awx/main/migrations/_rbac.py +++ b/awx/main/migrations/_rbac.py @@ -477,8 +477,6 @@ def rebuild_role_hierarchy(apps, schema_editor): start = time() roots = Role.objects \ .all() \ - .exclude(pk__in=Role.parents.through.objects.all() - .values_list('from_role_id', flat=True).distinct()) \ .values_list('id', flat=True) stop = time() logger.info('Found %d roots in %f seconds, rebuilding ancestry map' % (len(roots), stop - start))