mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -03:30
prevent instance group delete if running jobs
* related to https://github.com/ansible/ansible-tower/issues/7936
This commit is contained in:
18
awx/api/exceptions.py
Normal file
18
awx/api/exceptions.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2018 Ansible by Red Hat
|
||||
# All Rights Reserved.
|
||||
|
||||
# Django
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Django REST Framework
|
||||
from rest_framework.exceptions import ValidationError
|
||||
|
||||
|
||||
class ActiveJobConflict(ValidationError):
|
||||
status_code = 409
|
||||
|
||||
def __init__(self, active_jobs):
|
||||
super(ActiveJobConflict, self).__init__({
|
||||
"error": _("Resource is being used by running jobs."),
|
||||
"active_jobs": active_jobs
|
||||
})
|
||||
Reference in New Issue
Block a user