1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Wire token param into consul_api #2124

This commit is contained in:
fkuep 2021-03-28 00:50:28 +01:00
parent 73bb0f1900
commit b60b6433a8
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
bugfixes:
- plugins/lookup/consul_kv.py - use self.get_option and
wire the exsisting token attribute into consul_api call.
(https://github.com/ansible-collections/community.general/issues/2124)

View file

@ -138,6 +138,7 @@ class LookupModule(LookupBase):
host = u.hostname
if u.port is not None:
port = u.port
token = self.get_option('token')
validate_certs = self.get_option('validate_certs')
client_cert = self.get_option('client_cert')
@ -146,7 +147,7 @@ class LookupModule(LookupBase):
try:
for term in terms:
params = self.parse_params(term)
consul_api = consul.Consul(host=host, port=port, scheme=scheme, verify=validate_certs, cert=client_cert)
consul_api = consul.Consul(host=host, port=port, scheme=scheme, token=token, verify=validate_certs, cert=client_cert)
results = consul_api.kv.get(params['key'],
token=params['token'],