Skip to content

Commit 32fce43

Browse files
authored
hashi_vault: fix multiple spaces in params (ansible#51524)
Fixes param parsing in hashi_vault Signed-off-by: Abhijeet Kasurde <[email protected]>
1 parent 196e82e commit 32fce43

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/ansible/plugins/lookup/hashi_vault.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ def auth_approle(self, **kwargs):
252252

253253

254254
class LookupModule(LookupBase):
255-
def run(self, terms, variables, **kwargs):
255+
def run(self, terms, variables=None, **kwargs):
256256
if not HAS_HVAC:
257257
raise AnsibleError("Please pip install hvac to use the hashi_vault lookup module.")
258258

259-
vault_args = terms[0].split(' ')
259+
vault_args = terms[0].split()
260260
vault_dict = {}
261261
ret = []
262262

test/integration/targets/lookup_hashi_vault/lookup_hashi_vault/tasks/token_test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
set_fact:
66
secret1: "{{ lookup('hashi_vault', conn_params ~ 'secret=' ~ vault_base_path ~ '/secret1 auth_method=token token=' ~ user_token) }}"
77
secret2: "{{ lookup('hashi_vault', conn_params ~ 'secret=' ~ vault_base_path ~ '/secret2 token=' ~ user_token) }}"
8+
secret3: "{{ lookup('hashi_vault', conn_params ~ ' secret=' ~ vault_base_path ~ '/secret2 token=' ~ user_token) }}"
89

910
- name: 'Check secret values'
1011
fail:
1112
msg: 'unexpected secret values'
12-
when: secret1['data']['value'] != 'foo1' or secret2['data']['value'] != 'foo2'
13+
when: secret1['data']['value'] != 'foo1' or secret2['data']['value'] != 'foo2' or secret3['data']['value'] != 'foo2'
1314

1415
- name: 'Failure expected when erroneous credentials are used'
1516
vars:

0 commit comments

Comments
 (0)