mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added stub implementation of filters
This commit is contained in:
parent
bfed87df80
commit
993bb5c6f1
2 changed files with 11 additions and 3 deletions
|
@ -655,7 +655,7 @@ class Runner(object):
|
||||||
|
|
||||||
cmd = " || ".join(md5s)
|
cmd = " || ".join(md5s)
|
||||||
cmd = "%s; %s || (echo \"${rc} %s\")" % (test, cmd, path)
|
cmd = "%s; %s || (echo \"${rc} %s\")" % (test, cmd, path)
|
||||||
return self._low_level_exec_command(conn, cmd, tmp, sudoable=False).split()[0]
|
return utils.last_non_blank_line(self._low_level_exec_command(conn, cmd, tmp, sudoable=False)).split()[0]
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ class Runner(object):
|
||||||
cmd += ' && echo %s' % basetmp
|
cmd += ' && echo %s' % basetmp
|
||||||
|
|
||||||
result = self._low_level_exec_command(conn, cmd, None, sudoable=False)
|
result = self._low_level_exec_command(conn, cmd, None, sudoable=False)
|
||||||
return result.split("\n")[0].strip() + '/'
|
return utils.last_non_blank_line(result.split("\n"))[0].strip() + '/'
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,11 @@ def json_loads(data):
|
||||||
|
|
||||||
return json.loads(data)
|
return json.loads(data)
|
||||||
|
|
||||||
def parse_json(data):
|
def parse_json(raw_data):
|
||||||
''' this version for module return data only '''
|
''' this version for module return data only '''
|
||||||
|
|
||||||
|
data = filter_leading_garbage(raw_data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return json.loads(data)
|
return json.loads(data)
|
||||||
except:
|
except:
|
||||||
|
@ -409,3 +411,9 @@ def do_encrypt(result, encrypt, salt_size=None, salt=None):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def last_non_blank_line(lines):
|
||||||
|
return lines
|
||||||
|
|
||||||
|
def filter_leading_garbage(lines):
|
||||||
|
return lines
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue