mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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`.
This commit is contained in:
committed by
Brian Coca
parent
aff5d9160a
commit
200d6bdb23
@@ -287,7 +287,7 @@ class StrategyModule(StrategyBase):
|
||||
loop_var = 'item'
|
||||
if hr._task.loop_control:
|
||||
loop_var = hr._task.loop_control.loop_var or 'item'
|
||||
include_results = hr._result['results']
|
||||
include_results = hr._result.get('results', [])
|
||||
else:
|
||||
include_results = [ hr._result ]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user