make parsed param private and explicit (#17104)

* make parsed param private and explicit

* fixed missed parsed

(cherry picked from commit 5fe9d3c3d5)
This commit is contained in:
Brian Coca 2016-08-16 11:59:30 -04:00 committed by Brian Coca
parent d35377dac7
commit 2de8d2ece7
2 changed files with 4 additions and 3 deletions

View file

@ -587,13 +587,13 @@ class TaskExecutor:
# have issues which result in a half-written/unparseable result # have issues which result in a half-written/unparseable result
# file on disk, which manifests to the user as a timeout happening # file on disk, which manifests to the user as a timeout happening
# before it's time to timeout. # before it's time to timeout.
if int(async_result.get('finished', 0)) == 1 or ('failed' in async_result and async_result.get('parsed', False)) or 'skipped' in async_result: if int(async_result.get('finished', 0)) == 1 or ('failed' in async_result and async_result.get('_ansible_parsed', False)) or 'skipped' in async_result:
break break
time_left -= self._task.poll time_left -= self._task.poll
if int(async_result.get('finished', 0)) != 1: if int(async_result.get('finished', 0)) != 1:
if async_result.get('parsed'): if async_result.get('_ansible_parsed'):
return dict(failed=True, msg="async task did not complete within the requested time") return dict(failed=True, msg="async task did not complete within the requested time")
else: else:
return dict(failed=True, msg="async task produced unparseable results", async_result=async_result) return dict(failed=True, msg="async task produced unparseable results", async_result=async_result)

View file

@ -663,9 +663,10 @@ class ActionBase(with_metaclass(ABCMeta, object)):
def _parse_returned_data(self, res): def _parse_returned_data(self, res):
try: try:
data = json.loads(self._filter_non_json_lines(res.get('stdout', u''))) data = json.loads(self._filter_non_json_lines(res.get('stdout', u'')))
data['_ansible_parsed'] = True
except ValueError: except ValueError:
# not valid json, lets try to capture error # not valid json, lets try to capture error
data = dict(failed=True, parsed=False) data = dict(failed=True, _ansible_parsed=False)
data['msg'] = "MODULE FAILURE" data['msg'] = "MODULE FAILURE"
data['module_stdout'] = res.get('stdout', u'') data['module_stdout'] = res.get('stdout', u'')
if 'stderr' in res: if 'stderr' in res: