prevent creation of custom credential types that != 'cloud || network`

see: #6959
This commit is contained in:
Ryan Petrello
2017-07-10 16:34:25 -04:00
parent 335ab11914
commit 31829038bd
2 changed files with 27 additions and 0 deletions

View File

@@ -1904,6 +1904,11 @@ class CredentialTypeSerializer(BaseSerializer):
)
ret = super(CredentialTypeSerializer, self).validate(attrs)
if 'kind' in attrs and attrs['kind'] not in ('cloud', 'network'):
raise serializers.ValidationError({
"kind": _("Must be 'cloud' or 'network', not %s") % attrs['kind']
})
fields = attrs.get('inputs', {}).get('fields', [])
for field in fields:
if field.get('ask_at_runtime', False):