Don't assume a task with non-dict loop results has been skipped.

This changeset addresses the issue reported here:

  ansible/ansible-modules-core#1765

The yum module (at least) includes its task results as strings, rather than
dicts, and the code this changeset replaces assumed that in that instance the
task was skipped. The updated behaviour assumes that the task has been
skipped only if:

* results exist, and
* all results are dicts that include a truthy skipped value
pull/15747/head
Andrew Taumoefolau 9 years ago committed by nitzmahone
parent 478674cc57
commit 85868e07a9

@ -41,11 +41,8 @@ class TaskResult:
def is_skipped(self):
if 'results' in self._result and self._task.loop:
flag = True
for res in self._result.get('results', []):
if isinstance(res, dict):
flag &= res.get('skipped', False)
return flag
results = self._result['results']
return results and all(isinstance(res, dict) and res.get('skipped', False) for res in results)
else:
return self._result.get('skipped', False)

Loading…
Cancel
Save