mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 01:08:48 -03:30
Restore new style headers
This leads to having both the new style header and the old compatability header. Best of both worlds!
This commit is contained in:
@@ -102,6 +102,8 @@ def kv_backend(**kwargs):
|
|||||||
request_kwargs['verify'] = create_temporary_fifo(cacert.encode())
|
request_kwargs['verify'] = create_temporary_fifo(cacert.encode())
|
||||||
|
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
|
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
||||||
|
# Compatability header for older installs of Hashicorp Vault
|
||||||
sess.headers['X-Vault-Token'] = token
|
sess.headers['X-Vault-Token'] = token
|
||||||
|
|
||||||
if api_version == 'v2':
|
if api_version == 'v2':
|
||||||
@@ -157,6 +159,8 @@ def ssh_backend(**kwargs):
|
|||||||
request_kwargs['json']['valid_principals'] = kwargs['valid_principals']
|
request_kwargs['json']['valid_principals'] = kwargs['valid_principals']
|
||||||
|
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
|
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
||||||
|
# Compatability header for older installs of Hashicorp Vault
|
||||||
sess.headers['X-Vault-Token'] = token
|
sess.headers['X-Vault-Token'] = token
|
||||||
# https://www.vaultproject.io/api/secret/ssh/index.html#sign-ssh-key
|
# https://www.vaultproject.io/api/secret/ssh/index.html#sign-ssh-key
|
||||||
request_url = '/'.join([url, secret_path, 'sign', role]).rstrip('/')
|
request_url = '/'.join([url, secret_path, 'sign', role]).rstrip('/')
|
||||||
|
|||||||
Reference in New Issue
Block a user