prohibit direct creation of manual inventory sources

This commit is contained in:
AlanCoding
2017-07-07 11:28:58 -04:00
parent 0c3eac6aa0
commit 2c81a2489e
2 changed files with 10 additions and 2 deletions

View File

@@ -1640,6 +1640,12 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
def validate_source_project(self, value):
if value.scm_type == '':
raise serializers.ValidationError(_("Can not use manual project for SCM-based inventory."))
def validate_source(self, value):
if value == '':
raise serializers.ValidationError(
{"source": "Manual inventory sources are created automatically "
"when a group is created in the v1 API."})
return value
def validate(self, attrs):