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`.
pull/18551/head
Andrew Haines 8 years ago 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 ]

Loading…
Cancel
Save