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
This commit is contained in:
parent
198f57b61e
commit
da1e62a6d9
1 changed files with 2 additions and 5 deletions
|
@ -41,11 +41,8 @@ class TaskResult:
|
||||||
|
|
||||||
def is_skipped(self):
|
def is_skipped(self):
|
||||||
if 'results' in self._result and self._task.loop:
|
if 'results' in self._result and self._task.loop:
|
||||||
flag = True
|
results = self._result['results']
|
||||||
for res in self._result.get('results', []):
|
return results and all(isinstance(res, dict) and res.get('skipped', False) for res in results)
|
||||||
if isinstance(res, dict):
|
|
||||||
flag &= res.get('skipped', False)
|
|
||||||
return flag
|
|
||||||
else:
|
else:
|
||||||
return self._result.get('skipped', False)
|
return self._result.get('skipped', False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue