mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 10:10:01 -03:30
[credential_plugin/hashivault] add approle_auth_path in inputs
This commit is contained in:
@@ -41,11 +41,11 @@ base_inputs = {
|
|||||||
'secret': True,
|
'secret': True,
|
||||||
'help_text': _('The Secret ID for AppRole Authentication')
|
'help_text': _('The Secret ID for AppRole Authentication')
|
||||||
}, {
|
}, {
|
||||||
'id': 'auth_path',
|
'id': 'approle_auth_path',
|
||||||
'label': _('Path to Auth'),
|
'label': _('Path to Approle Auth'),
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'multiline': False,
|
'multiline': False,
|
||||||
'help_text': _('The path where the Authentication method is mounted e.g, approle')
|
'help_text': _('The path where the AppRole Authentication method is mounted e.g, approle')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'metadata': [{
|
'metadata': [{
|
||||||
@@ -53,6 +53,12 @@ base_inputs = {
|
|||||||
'label': _('Path to Secret'),
|
'label': _('Path to Secret'),
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'help_text': _('The path to the secret stored in the secret backend e.g, /some/secret/')
|
'help_text': _('The path to the secret stored in the secret backend e.g, /some/secret/')
|
||||||
|
}, {
|
||||||
|
'id': 'auth_path',
|
||||||
|
'label': _('Path to Auth'),
|
||||||
|
'type': 'string',
|
||||||
|
'multiline': False,
|
||||||
|
'help_text': _('The path where the Authentication method is mounted e.g, approle')
|
||||||
}],
|
}],
|
||||||
'required': ['url', 'secret_path'],
|
'required': ['url', 'secret_path'],
|
||||||
}
|
}
|
||||||
@@ -119,7 +125,11 @@ def handle_auth(**kwargs):
|
|||||||
def approle_auth(**kwargs):
|
def approle_auth(**kwargs):
|
||||||
role_id = kwargs['role_id']
|
role_id = kwargs['role_id']
|
||||||
secret_id = kwargs['secret_id']
|
secret_id = kwargs['secret_id']
|
||||||
auth_path = kwargs.get('auth_path') or 'approle'
|
# we first try to use the 'auth_path' from the metadata
|
||||||
|
# if not found we try to fetch the 'approle_auth_path' from inputs
|
||||||
|
# if not found we use the default value 'approle'
|
||||||
|
auth_path = \
|
||||||
|
kwargs.get('auth_path', kwargs.get('approle_auth_path', "approle"))
|
||||||
|
|
||||||
url = urljoin(kwargs['url'], 'v1')
|
url = urljoin(kwargs['url'], 'v1')
|
||||||
cacert = kwargs.get('cacert', None)
|
cacert = kwargs.get('cacert', None)
|
||||||
|
|||||||
Reference in New Issue
Block a user