mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
enforce required credential fields at job start time rather than on save
this is necessary for credential plugins support so that you can (in two
requests):
1. Save a Credential with _no_ input values defined
2. Create/associate one (or more) CredentialInputSource records to the
new Credential
This commit is contained in:
committed by
Jake McDermott
parent
e2d474ddd2
commit
42f4956a7f
@@ -655,13 +655,7 @@ class CredentialInputField(JSONSchemaField):
|
||||
)
|
||||
errors[error.schema['id']] = [error.message]
|
||||
|
||||
inputs = model_instance.credential_type.inputs
|
||||
defined_fields = model_instance.credential_type.defined_fields
|
||||
for field in inputs.get('required', []):
|
||||
if field in defined_fields and not value.get(field, None):
|
||||
errors[field] = [_('required for %s') % (
|
||||
model_instance.credential_type.name
|
||||
)]
|
||||
|
||||
# `ssh_key_unlock` requirements are very specific and can't be
|
||||
# represented without complicated JSON schema
|
||||
|
||||
Reference in New Issue
Block a user