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):
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue