Merge pull request #7189 from AlanCoding/dont_update_me_bro

Tell user how to use update_on_launch with source_project
This commit is contained in:
Alan Rominger
2017-07-20 10:25:08 -04:00
committed by GitHub

View File

@@ -1672,7 +1672,9 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
if attrs.get('source_path', None) and source!='scm':
raise serializers.ValidationError({"detail": _("Cannot set source_path if not SCM type.")})
elif update_on_launch and source=='scm' and update_on_project_update:
raise serializers.ValidationError({"detail": _("Cannot update SCM-based inventory source on launch.")})
raise serializers.ValidationError({"detail": _(
"Cannot update SCM-based inventory source on launch if set to update on project update. "
"Instead, configure the corresponding source project to update on launch.")})
elif not self.instance and attrs.get('inventory', None) and InventorySource.objects.filter(
inventory=attrs.get('inventory', None), update_on_project_update=True, source='scm').exists():
raise serializers.ValidationError({"detail": _("Inventory controlled by project-following SCM.")})