allow deletion of new jobs

This commit is contained in:
AlanCoding
2017-11-20 09:39:02 -05:00
parent 9b5371f2ab
commit 6c57a3bb68
3 changed files with 31 additions and 22 deletions

View File

@@ -140,7 +140,8 @@ class UnifiedJobDeletionMixin(object):
raise PermissionDenied(detail=_('Cannot delete job resource when associated workflow job is running.'))
except self.model.unified_job_node.RelatedObjectDoesNotExist:
pass
if obj.status in ACTIVE_STATES:
# Still allow deletion of new status, because these can be manually created
if obj.status in ACTIVE_STATES and obj.status != 'new':
raise PermissionDenied(detail=_("Cannot delete running job resource."))
obj.delete()
return Response(status=status.HTTP_204_NO_CONTENT)