mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
Fix up some flake8 issues
This commit is contained in:
@@ -2189,9 +2189,6 @@ class JobTemplateDetail(RetrieveUpdateDestroyAPIView):
|
|||||||
can_delete = request.user.can_access(JobTemplate, 'delete', obj)
|
can_delete = request.user.can_access(JobTemplate, 'delete', obj)
|
||||||
if not can_delete:
|
if not can_delete:
|
||||||
raise PermissionDenied("Cannot delete job template.")
|
raise PermissionDenied("Cannot delete job template.")
|
||||||
if obj.jobs.filter(status__in=['new', 'pending', 'waiting', 'running']).exists():
|
|
||||||
return Response({"error": "Delete not allowed while there are jobs running"},
|
|
||||||
status=status.HTTP_405_METHOD_NOT_ALLOWED)
|
|
||||||
return super(JobTemplateDetail, self).destroy(request, *args, **kwargs)
|
return super(JobTemplateDetail, self).destroy(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ class ProjectAccess(BaseAccess):
|
|||||||
return self.user in obj.admin_role
|
return self.user in obj.admin_role
|
||||||
|
|
||||||
def can_delete(self, obj):
|
def can_delete(self, obj):
|
||||||
is_change_allowed = self.can_change(obj, None)
|
is_change_allowed = self.can_change(obj, None)
|
||||||
if not is_change_allowed:
|
if not is_change_allowed:
|
||||||
return False
|
return False
|
||||||
active_jobs = []
|
active_jobs = []
|
||||||
|
|||||||
Reference in New Issue
Block a user