Merge pull request #318 from ansible/405_v2_job_launch

Prevent v2 direct job launches
This commit is contained in:
Matthew Jones 2017-08-22 11:01:14 -04:00 committed by GitHub
commit 031b5f3269

View File

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