mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
convey OpenStack verify_ssl defaults in the CredentialType schema
This commit is contained in:
@@ -671,6 +671,7 @@ class CredentialTypeInputField(JSONSchemaField):
|
||||
'multiline': {'type': 'boolean'},
|
||||
'secret': {'type': 'boolean'},
|
||||
'ask_at_runtime': {'type': 'boolean'},
|
||||
'default': {},
|
||||
},
|
||||
'additionalProperties': False,
|
||||
'required': ['id', 'label'],
|
||||
@@ -714,6 +715,14 @@ class CredentialTypeInputField(JSONSchemaField):
|
||||
# If no type is specified, default to string
|
||||
field['type'] = 'string'
|
||||
|
||||
if 'default' in field:
|
||||
default = field['default']
|
||||
_type = {'string': str, 'boolean': bool}[field['type']]
|
||||
if type(default) != _type:
|
||||
raise django_exceptions.ValidationError(
|
||||
_('{} is not a {}').format(default, field['type'])
|
||||
)
|
||||
|
||||
for key in ('choices', 'multiline', 'format', 'secret',):
|
||||
if key in field and field['type'] != 'string':
|
||||
raise django_exceptions.ValidationError(
|
||||
|
||||
Reference in New Issue
Block a user