From 687074a3d77bb35b171de6866893fcd987553e13 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 6 Jul 2017 16:24:26 -0400 Subject: [PATCH] allow reasonable scheduling of SCM inventory sources --- awx/api/serializers.py | 4 ++++ awx/main/constants.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 54959f4f1a..36ede42485 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -3396,6 +3396,10 @@ class ScheduleSerializer(BaseSerializer): raise serializers.ValidationError(_('Inventory Source must be a cloud resource.')) elif type(value) == Project and value.scm_type == '': raise serializers.ValidationError(_('Manual Project can not have a schedule set.')) + elif type(value) == InventorySource and value.source == 'scm' and value.update_on_project_update: + raise serializers.ValidationError(_( + 'Inventory sources with `update_on_project_update` can not be shceduled. ' + 'Schedule its source project `{}` instead.'.format(value.source_project.name))) return value # We reject rrules if: diff --git a/awx/main/constants.py b/awx/main/constants.py index bd0e220c1c..c68adadcc4 100644 --- a/awx/main/constants.py +++ b/awx/main/constants.py @@ -2,4 +2,4 @@ # All Rights Reserved. CLOUD_PROVIDERS = ('azure', 'azure_rm', 'ec2', 'gce', 'rax', 'vmware', 'openstack', 'satellite6', 'cloudforms') -SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom',) +SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom', 'scm',)