mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #24 from matburt/make_credential_required
Make credential required when using a cloud inventory source
This commit is contained in:
commit
3beab0a22e
@ -1024,6 +1024,13 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
||||
# FIXME
|
||||
return attrs
|
||||
|
||||
def validate_credential(self, attrs, source):
|
||||
src = attrs.get('source', '')
|
||||
if src in CLOUD_PROVIDERS:
|
||||
if attrs.get(source, None) is None:
|
||||
raise serializers.ValidationError("Credential is required for Cloud source types")
|
||||
return attrs
|
||||
|
||||
def validate_source_script(self, attrs, source):
|
||||
src = attrs.get(source, None)
|
||||
if 'source' in attrs and attrs.get('source', '') == 'custom':
|
||||
|
Loading…
Reference in New Issue
Block a user