From f3f10df361884d5060796f467181eeaab0309c51 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 22 Aug 2017 09:53:10 -0400 Subject: [PATCH] IFF v2 api disallow direct job launches --- awx/api/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/awx/api/views.py b/awx/api/views.py index cf40687256..ea53e4e973 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -3739,6 +3739,13 @@ class JobList(ListCreateAPIView): methods.remove('POST') return methods + # NOTE: Remove in 3.3, switch ListCreateAPIView to ListAPIView + def post(self, request, *args, **kwargs): + if get_request_version(self.request) > 1: + return Response({"error": _("POST not allowed for Job launching in version 2 of the api")}, + status=status.HTTP_405_METHOD_NOT_ALLOWED) + return super(JobList, self).post(request, *args, **kwargs) + class JobDetail(UnifiedJobDeletionMixin, RetrieveUpdateDestroyAPIView):