mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
hashi_vault: fix multiple spaces in params (#51524)
Fixes param parsing in hashi_vault Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
196e82ec8a
commit
32fce43311
2 changed files with 4 additions and 3 deletions
|
@ -252,11 +252,11 @@ class HashiVault:
|
|||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
def run(self, terms, variables, **kwargs):
|
||||
def run(self, terms, variables=None, **kwargs):
|
||||
if not HAS_HVAC:
|
||||
raise AnsibleError("Please pip install hvac to use the hashi_vault lookup module.")
|
||||
|
||||
vault_args = terms[0].split(' ')
|
||||
vault_args = terms[0].split()
|
||||
vault_dict = {}
|
||||
ret = []
|
||||
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
set_fact:
|
||||
secret1: "{{ lookup('hashi_vault', conn_params ~ 'secret=' ~ vault_base_path ~ '/secret1 auth_method=token token=' ~ user_token) }}"
|
||||
secret2: "{{ lookup('hashi_vault', conn_params ~ 'secret=' ~ vault_base_path ~ '/secret2 token=' ~ user_token) }}"
|
||||
secret3: "{{ lookup('hashi_vault', conn_params ~ ' secret=' ~ vault_base_path ~ '/secret2 token=' ~ user_token) }}"
|
||||
|
||||
- name: 'Check secret values'
|
||||
fail:
|
||||
msg: 'unexpected secret values'
|
||||
when: secret1['data']['value'] != 'foo1' or secret2['data']['value'] != 'foo2'
|
||||
when: secret1['data']['value'] != 'foo1' or secret2['data']['value'] != 'foo2' or secret3['data']['value'] != 'foo2'
|
||||
|
||||
- name: 'Failure expected when erroneous credentials are used'
|
||||
vars:
|
||||
|
|
Loading…
Reference in a new issue