provisionning: do not fail on missing role (#50014)
gitea-wip/hobo/pipeline/head There was a failure building this commit Details
gitea/hobo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Emmanuel Cazenave 2021-03-30 14:20:11 +02:00
parent 78efa6b5db
commit 5291a38e9b
1 changed files with 4 additions and 1 deletions

View File

@ -153,7 +153,10 @@ class Provisionning(threading.local):
user_roles = {}
parents = {}
for rp in RoleParenting.objects.all():
parents.setdefault(rp.child.id, []).append(rp.parent.id)
try:
parents.setdefault(rp.child.id, []).append(rp.parent.id)
except Role.DoesNotExist:
pass
Through = Role.members.through
qs = Through.objects.filter(role__members__in=users).values_list('user_id', 'role_id')
for u_id, r_id in qs: