mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Add new to the list of statuses that will be canceled if a job's parent
is removed
This commit is contained in:
parent
8d0cdd66e0
commit
983eb43aec
@ -575,7 +575,7 @@ class ProjectDetail(RetrieveUpdateDestroyAPIView):
|
||||
can_delete = request.user.can_access(Project, 'delete', obj)
|
||||
if not can_delete:
|
||||
raise PermissionDenied("Cannot delete project")
|
||||
for pu in obj.project_updates.filter(status__in=['pending', 'waiting', 'running']):
|
||||
for pu in obj.project_updates.filter(status__in=['new', 'pending', 'waiting', 'running']):
|
||||
pu.cancel()
|
||||
return super(ProjectDetail, self).destroy(request, *args, **kwargs)
|
||||
|
||||
@ -1262,7 +1262,7 @@ class InventorySourceDetail(RetrieveUpdateAPIView):
|
||||
can_delete = request.user.can_access(InventorySource, 'delete', obj)
|
||||
if not can_delete:
|
||||
raise PermissionDenied("Cannot delete inventory source")
|
||||
for pu in obj.inventory_updates.filter(status__in=['pending', 'waiting', 'running']):
|
||||
for pu in obj.inventory_updates.filter(status__in=['new', 'pending', 'waiting', 'running']):
|
||||
pu.cancel()
|
||||
return super(InventorySourceDetail, self).destroy(request, *args, **kwargs)
|
||||
|
||||
@ -1376,7 +1376,7 @@ class JobTemplateDetail(RetrieveUpdateDestroyAPIView):
|
||||
can_delete = request.user.can_access(JobTemplate, 'delete', obj)
|
||||
if not can_delete:
|
||||
raise PermissionDenied("Cannot delete job template")
|
||||
for pu in obj.jobs.filter(status__in=['pending', 'waiting', 'running']):
|
||||
for pu in obj.jobs.filter(status__in=['new', 'pending', 'waiting', 'running']):
|
||||
pu.cancel()
|
||||
return super(JobTemplateDetail, self).destroy(request, *args, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user