mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 05:31:22 -03:30
prevent host deletion when the related inventory is pending deletion
see: https://github.com/ansible/tower/issues/2690
This commit is contained in:
parent
9ff249f5c4
commit
5610cbe735
@ -2251,6 +2251,12 @@ class HostDetail(RelatedJobsPreventDeleteMixin, ControlledByScmMixin, RetrieveUp
|
||||
model = Host
|
||||
serializer_class = HostSerializer
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
if self.get_object().inventory.pending_deletion:
|
||||
return Response({"error": _("The inventory for this host is already being deleted.")},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
return super(HostDetail, self).delete(request, *args, **kwargs)
|
||||
|
||||
|
||||
class HostAnsibleFactsDetail(RetrieveAPIView):
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user