From 4b669fb16decaab824e64bbdc78de4683677fe95 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 5 Feb 2019 13:30:51 -0500 Subject: [PATCH] Remove limit on `limit` field. This allows 'relaunch-on-failed' on an arbitrary number of failed hosts. --- awx/api/views/__init__.py | 5 ---- .../0058_v350_remove_limit_limit.py | 25 +++++++++++++++++++ awx/main/models/jobs.py | 3 +-- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 awx/main/migrations/0058_v350_remove_limit_limit.py diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index fb90808e40..d2670c09f5 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -3618,11 +3618,6 @@ 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_length, 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']) diff --git a/awx/main/migrations/0058_v350_remove_limit_limit.py b/awx/main/migrations/0058_v350_remove_limit_limit.py new file mode 100644 index 0000000000..24ab66f9f6 --- /dev/null +++ b/awx/main/migrations/0058_v350_remove_limit_limit.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2019-02-05 18:29 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0057_v350_remove_become_method_type'), + ] + + operations = [ + migrations.AlterField( + model_name='job', + name='limit', + field=models.TextField(blank=True, default=''), + ), + migrations.AlterField( + model_name='jobtemplate', + name='limit', + field=models.TextField(blank=True, default=''), + ), + ] diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 74cccb2fd5..afdfc2cb54 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -93,8 +93,7 @@ class JobOptions(BaseModel): blank=True, default=0, ) - limit = models.CharField( - max_length=1024, + limit = models.TextField( blank=True, default='', )