Merge pull request #9890 from ryanpetrello/schedule-invalid-ujt

allow schedules to be disabled even if the associated UJT isn't valid

see: #8641

Reviewed-by: Christian Adams <rooftopcellist@gmail.com>
Reviewed-by: Jeff Bradberry <None>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-04-13 17:20:51 +00:00 committed by GitHub
commit b82318161c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4813,6 +4813,14 @@ class ScheduleSerializer(LaunchConfigurationBaseSerializer, SchedulePreviewSeria
)
return value
def validate(self, attrs):
# if the schedule is being disabled, there's no need
# validate the related UnifiedJobTemplate
# see: https://github.com/ansible/awx/issues/8641
if self.context['request'].method == 'PATCH' and attrs == {'enabled': False}:
return attrs
return super(ScheduleSerializer, self).validate(attrs)
class InstanceSerializer(BaseSerializer):