mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Decouple inject_credentials from dynamic inputs
* Preparation for moving inject_credentials out of this repo
This commit is contained in:
parent
699c0c769d
commit
e411f3534f
@ -364,6 +364,15 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
raise ValueError('{} is not an input field'.format(name))
|
||||
return True
|
||||
|
||||
def get_input_keys(self) -> list[str]:
|
||||
"""
|
||||
Return a unique list of both static and dynamic credential input keys.
|
||||
|
||||
:returns: List of input field names
|
||||
:rtype: list[str]
|
||||
"""
|
||||
return list(set(self.inputs.keys()) | set(self.dynamic_input_fields))
|
||||
|
||||
def _get_dynamic_input(self, field_name):
|
||||
for input_source in self.input_sources.all():
|
||||
if input_source.input_field_name == field_name:
|
||||
@ -587,8 +596,7 @@ class CredentialType(CommonModelNameNotUnique):
|
||||
# build a normal namespace with secret values decrypted (for
|
||||
# ansible-playbook) and a safe namespace with secret values hidden (for
|
||||
# DB storage)
|
||||
injectable_fields = list(credential.inputs.keys()) + credential.dynamic_input_fields
|
||||
for field_name in list(set(injectable_fields)):
|
||||
for field_name in credential.get_input_keys():
|
||||
value = credential.get_input(field_name)
|
||||
|
||||
if type(value) is bool:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user