hashi_vault: fix multiple spaces in params (#51524)

Fixes param parsing in hashi_vault

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/52153/head
Abhijeet Kasurde 5 years ago committed by GitHub
parent 196e82ec8a
commit 32fce43311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save