Default include_role results to empty list in linear strategy plugin
Fixes #18544.
When a loop is over an empty list, the result is set to
{'skipped_reason': u'No items in the list', 'skipped': True, 'changed': False}
which means that accessing `hr._result['results']` throws a `KeyError`.
(cherry picked from commit 200d6bdb23
)
This commit is contained in:
parent
0871d955fe
commit
35e198a616
1 changed files with 1 additions and 1 deletions
|
@ -287,7 +287,7 @@ class StrategyModule(StrategyBase):
|
||||||
loop_var = 'item'
|
loop_var = 'item'
|
||||||
if hr._task.loop_control:
|
if hr._task.loop_control:
|
||||||
loop_var = hr._task.loop_control.loop_var or 'item'
|
loop_var = hr._task.loop_control.loop_var or 'item'
|
||||||
include_results = hr._result['results']
|
include_results = hr._result.get('results', [])
|
||||||
else:
|
else:
|
||||||
include_results = [ hr._result ]
|
include_results = [ hr._result ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue