mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
try more linting
This commit is contained in:
parent
87eeec7180
commit
91c8d06e6a
1 changed files with 18 additions and 18 deletions
|
@ -138,31 +138,31 @@ class LookupModule(LookupBase):
|
||||||
if u.port is not None:
|
if u.port is not None:
|
||||||
port = u.port
|
port = u.port
|
||||||
token = self.get_option('token')
|
token = self.get_option('token')
|
||||||
datacenter=self.get_option('datacenter')
|
datacenter = self.get_option('datacenter')
|
||||||
recurse=self.get_option('recurse')
|
recurse = self.get_option('recurse')
|
||||||
index=self.get_option('index')
|
index = self.get_option('index')
|
||||||
|
|
||||||
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')
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
try:
|
try:
|
||||||
for term in terms:
|
for term in terms:
|
||||||
key = term.split(' ')[0]
|
key = term.split(' ')[0]
|
||||||
consul_api = consul.Consul(host=host, port=port, scheme=scheme, token=token,
|
consul_api = consul.Consul(host=host, port=port, scheme=scheme, token=token,
|
||||||
dc=datacenter,verify=validate_certs, cert=client_cert)
|
dc=datacenter, verify=validate_certs, cert=client_cert)
|
||||||
|
|
||||||
results = consul_api.kv.get(key,
|
results = consul_api.kv.get(key,
|
||||||
index=index,
|
index=index,
|
||||||
recurse=recurse,
|
recurse=recurse,
|
||||||
)
|
)
|
||||||
if results[1]:
|
if results[1]:
|
||||||
# responds with a single or list of result maps
|
# responds with a single or list of result maps
|
||||||
if isinstance(results[1], list):
|
if isinstance(results[1], list):
|
||||||
for r in results[1]:
|
for r in results[1]:
|
||||||
values.append(to_text(r['Value']))
|
values.append(to_text(r['Value']))
|
||||||
else:
|
else:
|
||||||
values.append(to_text(results[1]['Value']))
|
values.append(to_text(results[1]['Value']))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AnsibleError(
|
raise AnsibleError(
|
||||||
"Error locating '%s' in kv store. Error was %s" % (key, e))
|
"Error locating '%s' in kv store. Error was %s" % (key, e))
|
||||||
|
|
Loading…
Reference in a new issue