mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 14:36:00 -03:30
Supress exception with concurrent deletion
Relates https://github.com/ansible/ansible-tower/issues/7768 This issue, as well as https://github.com/ansible/ansible-tower/issues/7622, both rooted in a concurrency issue of Django ORM: https://github.com/ansible/ansible-tower/issues/762://code.djangoproject.com/ticket/28806 The solution related deals specifically with the related issue, but is not a general solution. A general workaround can be found in https://github.com/ansible/tower/pull/500. Signed-off-by: Aaron Tan <jangsutsr@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from django.db.models import Q, Prefetch
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
# Django REST Framework
|
||||
from rest_framework.exceptions import ParseError, PermissionDenied, ValidationError
|
||||
@@ -1134,8 +1135,11 @@ class ProjectUpdateAccess(BaseAccess):
|
||||
|
||||
def can_start(self, obj, validate_license=True):
|
||||
# for relaunching
|
||||
if obj and obj.project:
|
||||
return self.user in obj.project.update_role
|
||||
try:
|
||||
if obj and obj.project:
|
||||
return self.user in obj.project.update_role
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
return False
|
||||
|
||||
@check_superuser
|
||||
|
||||
Reference in New Issue
Block a user