From 6e3b2a5c2dfa75fc0ed1e8d2e51fe41e9a2ce637 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Mon, 15 Oct 2018 13:18:50 -0400 Subject: [PATCH] better error handling when over limit --- awx/api/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/api/views.py b/awx/api/views.py index 3492396477..0b4da2f21d 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -4335,6 +4335,11 @@ class JobRelaunch(RetrieveAPIView): 'Cannot relaunch because previous job had 0 {status_value} hosts.' ).format(status_value=retry_hosts)}, status=status.HTTP_400_BAD_REQUEST) copy_kwargs['limit'] = ','.join(retry_host_list) + limit_length = len(copy_kwargs['limit']) + if limit_length > 1024: + return Response({'limit': _( + 'Cannot relaunch because the limit length {limit_length} exceeds the max of {limit_max}.' + ).format(limit_length=limit_lengh, limit_max=1024)}, status=status.HTTP_400_BAD_REQUEST) new_job = obj.copy_unified_job(**copy_kwargs) result = new_job.signal_start(**serializer.validated_data['credential_passwords'])