From 64da67fa2e75048fbaadfc398e3f736279e90584 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 25 Aug 2020 09:25:54 -0400 Subject: [PATCH] mprove error message when changing an inventory from regular -> smart see: https://github.com/ansible/awx/issues/5744 Co-Authored-By: kldavis52 --- awx/api/views/inventory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/api/views/inventory.py b/awx/api/views/inventory.py index 987f5467b4..607a71c6d5 100644 --- a/awx/api/views/inventory.py +++ b/awx/api/views/inventory.py @@ -134,7 +134,8 @@ class InventoryDetail(RelatedJobsPreventDeleteMixin, ControlledByScmMixin, Retri # Do not allow changes to an Inventory kind. if kind is not None and obj.kind != kind: - return self.http_method_not_allowed(request, *args, **kwargs) + return Response(dict(error=_('You cannot turn a regular inventory into a "smart" inventory.')), + status=status.HTTP_405_METHOD_NOT_ALLOWED) return super(InventoryDetail, self).update(request, *args, **kwargs) def destroy(self, request, *args, **kwargs):