mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Disallow multiple schedules for System Job Templates
This commit is contained in:
parent
73636ef1a0
commit
0de53886da
@ -1766,6 +1766,12 @@ class SystemJobTemplateSchedulesList(SubListCreateAPIView):
|
||||
relationship = 'schedules'
|
||||
parent_key = 'unified_job_template'
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
system_job = self.get_parent_object()
|
||||
if system_job.schedules.count() > 0:
|
||||
return Response({"error": "Multiple schedules for Systems Jobs is not allowed"}, status=status.HTTP_400_BAD_REQUEST)
|
||||
return super(SystemJobTemplateSchedulesList, self).post(request, *args, **kwargs)
|
||||
|
||||
class SystemJobTemplateJobsList(SubListAPIView):
|
||||
|
||||
model = SystemJob
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user