mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-15 05:29:11 -07:00
Optionally return raw data from URL lookup using split_lines=False
This commit is contained in:
parent
91b87d4cbb
commit
0e0e5097a9
1 changed files with 6 additions and 2 deletions
|
@ -36,6 +36,7 @@ class LookupModule(LookupBase):
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables=None, **kwargs):
|
||||||
|
|
||||||
validate_certs = kwargs.get('validate_certs', True)
|
validate_certs = kwargs.get('validate_certs', True)
|
||||||
|
split_lines = kwargs.get('split_lines', True)
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
for term in terms:
|
for term in terms:
|
||||||
|
@ -51,6 +52,9 @@ class LookupModule(LookupBase):
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
raise AnsibleError("Error connecting to %s: %s" % (term, str(e)))
|
raise AnsibleError("Error connecting to %s: %s" % (term, str(e)))
|
||||||
|
|
||||||
for line in response.read().splitlines():
|
if split_lines:
|
||||||
ret.append(to_text(line))
|
for line in response.read().splitlines():
|
||||||
|
ret.append(to_text(line))
|
||||||
|
else:
|
||||||
|
ret.append(to_text(response.read()))
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue