mprove error message when changing an inventory from regular -> smart

see: https://github.com/ansible/awx/issues/5744
Co-Authored-By: kldavis52 <kyle.linnard.davis@gmail.com>
This commit is contained in:
Ryan Petrello 2020-08-25 09:25:54 -04:00
parent 5248ac4498
commit 64da67fa2e
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -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):