mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Wire token param into consul_api #2124
This commit is contained in:
5
changelogs/fragments/2124-consul_kv-pass-token.yml
Normal file
5
changelogs/fragments/2124-consul_kv-pass-token.yml
Normal 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)
|
||||||
@@ -138,6 +138,7 @@ class LookupModule(LookupBase):
|
|||||||
host = u.hostname
|
host = u.hostname
|
||||||
if u.port is not None:
|
if u.port is not None:
|
||||||
port = u.port
|
port = u.port
|
||||||
|
token = self.get_option('token')
|
||||||
|
|
||||||
validate_certs = self.get_option('validate_certs')
|
validate_certs = self.get_option('validate_certs')
|
||||||
client_cert = self.get_option('client_cert')
|
client_cert = self.get_option('client_cert')
|
||||||
@@ -146,7 +147,7 @@ class LookupModule(LookupBase):
|
|||||||
try:
|
try:
|
||||||
for term in terms:
|
for term in terms:
|
||||||
params = self.parse_params(term)
|
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'],
|
results = consul_api.kv.get(params['key'],
|
||||||
token=params['token'],
|
token=params['token'],
|
||||||
|
|||||||
Reference in New Issue
Block a user