mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Optionally return raw data from URL lookup using split_lines=False
This commit is contained in:
committed by
Brian Coca
parent
91b87d4cbb
commit
0e0e5097a9
@@ -36,6 +36,7 @@ class LookupModule(LookupBase):
|
||||
def run(self, terms, variables=None, **kwargs):
|
||||
|
||||
validate_certs = kwargs.get('validate_certs', True)
|
||||
split_lines = kwargs.get('split_lines', True)
|
||||
|
||||
ret = []
|
||||
for term in terms:
|
||||
@@ -51,6 +52,9 @@ class LookupModule(LookupBase):
|
||||
except ConnectionError as e:
|
||||
raise AnsibleError("Error connecting to %s: %s" % (term, str(e)))
|
||||
|
||||
for line in response.read().splitlines():
|
||||
ret.append(to_text(line))
|
||||
if split_lines:
|
||||
for line in response.read().splitlines():
|
||||
ret.append(to_text(line))
|
||||
else:
|
||||
ret.append(to_text(response.read()))
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user