mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
Extract the field from the secret.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
from .plugin import CredentialPlugin
|
from .plugin import CredentialPlugin
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from thycotic.secrets.server import SecretServer, PasswordGrantAuthorizer
|
from thycotic.secrets.server import PasswordGrantAuthorizer, SecretServer, ServerSecret
|
||||||
|
|
||||||
tss_inputs = {
|
tss_inputs = {
|
||||||
'fields': [
|
'fields': [
|
||||||
@@ -32,14 +32,22 @@ tss_inputs = {
|
|||||||
'help_text': _('The integer ID of the secret'),
|
'help_text': _('The integer ID of the secret'),
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'id': 'secret_field',
|
||||||
|
'label': _('Secret Field'),
|
||||||
|
'help_text': _('The field to extract from the secret'),
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
'required': ['server_url', 'username', 'password', 'secret_id'],
|
'required': ['server_url', 'username', 'password', 'secret_id', 'secret_field'],
|
||||||
}
|
}
|
||||||
|
|
||||||
tss_plugin = CredentialPlugin(
|
tss_plugin = CredentialPlugin(
|
||||||
'Thycotic Secret Server',
|
'Thycotic Secret Server',
|
||||||
tss_inputs,
|
tss_inputs,
|
||||||
lambda **kwargs: SecretServer(kwargs['server_url'], PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'])).get_secret(
|
lambda **kwargs: ServerSecret(
|
||||||
kwargs['secret_id']
|
**SecretServer(kwargs['server_url'], PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'])).get_secret(
|
||||||
),
|
kwargs['secret_id']
|
||||||
|
)
|
||||||
|
).fields[kwargs['secret_field']],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user