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
2 changed files with 26 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
from .plugin import CredentialPlugin from .plugin import CredentialPlugin
from django.utils.translation import ugettext_lazy as _
from azure.keyvault import KeyVaultClient, KeyVaultAuthentication from azure.keyvault import KeyVaultClient, KeyVaultAuthentication
from azure.common.credentials import ServicePrincipalCredentials from azure.common.credentials import ServicePrincipalCredentials
@@ -7,32 +8,32 @@ from azure.common.credentials import ServicePrincipalCredentials
azure_keyvault_inputs = { azure_keyvault_inputs = {
'fields': [{ 'fields': [{
'id': 'url', 'id': 'url',
'label': 'Vault URL (DNS Name)', 'label': _('Vault URL (DNS Name)'),
'type': 'string', 'type': 'string',
}, { }, {
'id': 'client', 'id': 'client',
'label': 'Client ID', 'label': _('Client ID'),
'type': 'string' 'type': 'string'
}, { }, {
'id': 'secret', 'id': 'secret',
'label': 'Client Secret', 'label': _('Client Secret'),
'type': 'string', 'type': 'string',
'secret': True, 'secret': True,
}, { }, {
'id': 'tenant', 'id': 'tenant',
'label': 'Tenant ID', 'label': _('Tenant ID'),
'type': 'string' 'type': 'string'
}], }],
'metadata': [{ 'metadata': [{
'id': 'secret_field', 'id': 'secret_field',
'label': 'Secret Name', 'label': _('Secret Name'),
'type': 'string', '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', 'id': 'secret_version',
'label': 'Secret Version', 'label': _('Secret Version'),
'type': 'string', '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'], 'required': ['url', 'client', 'secret', 'tenant', 'secret_field'],
} }

View File

@@ -6,26 +6,27 @@ from urllib.parse import urljoin
from .plugin import CredentialPlugin from .plugin import CredentialPlugin
import requests import requests
from django.utils.translation import ugettext_lazy as _
base_inputs = { base_inputs = {
'fields': [{ 'fields': [{
'id': 'url', 'id': 'url',
'label': 'Server URL', 'label': _('Server URL'),
'type': 'string', 'type': 'string',
'help_text': 'The URL to the HashiCorp Vault', 'help_text': _('The URL to the HashiCorp Vault'),
}, { }, {
'id': 'token', 'id': 'token',
'label': 'Token', 'label': _('Token'),
'type': 'string', 'type': 'string',
'secret': True, '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': [{ 'metadata': [{
'id': 'secret_path', 'id': 'secret_path',
'label': 'Path to Secret', 'label': _('Path to Secret'),
'type': 'string', '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'], 'required': ['url', 'token', 'secret_path'],
} }
@@ -33,35 +34,35 @@ base_inputs = {
hashi_kv_inputs = copy.deepcopy(base_inputs) hashi_kv_inputs = copy.deepcopy(base_inputs)
hashi_kv_inputs['fields'].append({ hashi_kv_inputs['fields'].append({
'id': 'api_version', 'id': 'api_version',
'label': 'API Version', 'label': _('API Version'),
'choices': ['v1', 'v2'], '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', 'default': 'v1',
}) })
hashi_kv_inputs['metadata'].extend([{ hashi_kv_inputs['metadata'].extend([{
'id': 'secret_key', 'id': 'secret_key',
'label': 'Key Name', 'label': _('Key Name'),
'type': 'string', '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', 'id': 'secret_version',
'label': 'Secret Version (v2 only)', 'label': _('Secret Version (v2 only)'),
'type': 'string', '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_kv_inputs['required'].extend(['api_version', 'secret_key'])
hashi_ssh_inputs = copy.deepcopy(base_inputs) hashi_ssh_inputs = copy.deepcopy(base_inputs)
hashi_ssh_inputs['metadata'].extend([{ hashi_ssh_inputs['metadata'].extend([{
'id': 'role', 'id': 'role',
'label': 'Role Name', 'label': _('Role Name'),
'type': 'string', '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', 'id': 'valid_principals',
'label': 'Valid Principals', 'label': _('Valid Principals'),
'type': 'string', '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']) hashi_ssh_inputs['required'].extend(['role'])