1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

mark cred plugin strings for translation

This commit is contained in:
Ryan Petrello 2019-02-25 22:52:47 -05:00 committed by Jake McDermott
parent b851e2be4a
commit dcf17683e2
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7
2 changed files with 26 additions and 24 deletions

View File

@ -1,5 +1,6 @@
from .plugin import CredentialPlugin
from django.utils.translation import ugettext_lazy as _
from azure.keyvault import KeyVaultClient, KeyVaultAuthentication
from azure.common.credentials import ServicePrincipalCredentials
@ -7,32 +8,32 @@ from azure.common.credentials import ServicePrincipalCredentials
azure_keyvault_inputs = {
'fields': [{
'id': 'url',
'label': 'Vault URL (DNS Name)',
'label': _('Vault URL (DNS Name)'),
'type': 'string',
}, {
'id': 'client',
'label': 'Client ID',
'label': _('Client ID'),
'type': 'string'
}, {
'id': 'secret',
'label': 'Client Secret',
'label': _('Client Secret'),
'type': 'string',
'secret': True,
}, {
'id': 'tenant',
'label': 'Tenant ID',
'label': _('Tenant ID'),
'type': 'string'
}],
'metadata': [{
'id': 'secret_field',
'label': 'Secret Name',
'label': _('Secret Name'),
'type': 'string',
'help_text': 'The name of the secret to look up.',
'help_text': _('The name of the secret to look up.'),
}, {
'id': 'secret_version',
'label': 'Secret Version',
'label': _('Secret Version'),
'type': 'string',
'help_text': 'Used to specify a specific secret version (if left empty, the latest version will be used).',
'help_text': _('Used to specify a specific secret version (if left empty, the latest version will be used).'),
}],
'required': ['url', 'client', 'secret', 'tenant', 'secret_field'],
}

View File

@ -6,26 +6,27 @@ from urllib.parse import urljoin
from .plugin import CredentialPlugin
import requests
from django.utils.translation import ugettext_lazy as _
base_inputs = {
'fields': [{
'id': 'url',
'label': 'Server URL',
'label': _('Server URL'),
'type': 'string',
'help_text': 'The URL to the HashiCorp Vault',
'help_text': _('The URL to the HashiCorp Vault'),
}, {
'id': 'token',
'label': 'Token',
'label': _('Token'),
'type': 'string',
'secret': True,
'help_text': 'The access token used to authenticate to the Vault server',
'help_text': _('The access token used to authenticate to the Vault server'),
}],
'metadata': [{
'id': 'secret_path',
'label': 'Path to Secret',
'label': _('Path to Secret'),
'type': 'string',
'help_text': 'The path to the secret e.g., /some-engine/some-secret/',
'help_text': _('The path to the secret e.g., /some-engine/some-secret/'),
}],
'required': ['url', 'token', 'secret_path'],
}
@ -33,35 +34,35 @@ base_inputs = {
hashi_kv_inputs = copy.deepcopy(base_inputs)
hashi_kv_inputs['fields'].append({
'id': 'api_version',
'label': 'API Version',
'label': _('API Version'),
'choices': ['v1', 'v2'],
'help_text': 'API v1 is for static key/value lookups. API v2 is for versioned key/value lookups.',
'help_text': _('API v1 is for static key/value lookups. API v2 is for versioned key/value lookups.'),
'default': 'v1',
})
hashi_kv_inputs['metadata'].extend([{
'id': 'secret_key',
'label': 'Key Name',
'label': _('Key Name'),
'type': 'string',
'help_text': 'The name of the key to look up in the secret.',
'help_text': _('The name of the key to look up in the secret.'),
}, {
'id': 'secret_version',
'label': 'Secret Version (v2 only)',
'label': _('Secret Version (v2 only)'),
'type': 'string',
'help_text': 'Used to specify a specific secret version (if left empty, the latest version will be used).',
'help_text': _('Used to specify a specific secret version (if left empty, the latest version will be used).'),
}])
hashi_kv_inputs['required'].extend(['api_version', 'secret_key'])
hashi_ssh_inputs = copy.deepcopy(base_inputs)
hashi_ssh_inputs['metadata'].extend([{
'id': 'role',
'label': 'Role Name',
'label': _('Role Name'),
'type': 'string',
'help_text': 'The name of the role used to sign.'
'help_text': _('The name of the role used to sign.')
}, {
'id': 'valid_principals',
'label': 'Valid Principals',
'label': _('Valid Principals'),
'type': 'string',
'help_text': 'Valid principals (either usernames or hostnames) that the certificate should be signed for.',
'help_text': _('Valid principals (either usernames or hostnames) that the certificate should be signed for.'),
}])
hashi_ssh_inputs['required'].extend(['role'])