Merge pull request #6909 from AlanCoding/no_manual_source_proj

Disallow manual projects for SCM inventory
This commit is contained in:
Alan Rominger
2017-07-12 12:08:19 -04:00
committed by GitHub
4 changed files with 24 additions and 5 deletions

View File

@@ -1637,6 +1637,11 @@ class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOpt
ret['inventory'] = None
return ret
def validate_source_project(self, value):
if value.scm_type == '':
raise serializers.ValidationError(_("Can not use manual project for SCM-based inventory."))
return value
def validate(self, attrs):
def get_field_from_model_or_attrs(fd):
return attrs.get(fd, self.instance and getattr(self.instance, fd) or None)