From 2fe1ae189a0326038a8876bc9bbfd98b2f885cd3 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 7 Apr 2014 13:35:07 -0400 Subject: [PATCH] Fix issue AC-1152... disallow creating a schedule for non-cloud inventory sources --- awx/api/serializers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index fa2600ce77..99c9a591c3 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1372,6 +1372,12 @@ class ScheduleSerializer(BaseSerializer): res['unified_job_template'] = ujt.get_absolute_url() #obj.unified_job_template.get_absolute_url() return res + def validate_unified_job_template(self, attrs, source): + ujt = attrs[source] + if type(ujt) == InventorySource and ujt.source not in ('rax', 'ec2',): + raise serializers.ValidationError('Inventory Source must be a cloud resource') + return attrs + # We reject rrules if: # - DTSTART is not include # - INTERVAL is not included