From 3f968ff46af67d801f4b5e1ff2e82abcb662df05 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 9 Oct 2013 17:14:18 -0400 Subject: [PATCH] Check one more skipped scenario in with_subelements. --- lib/ansible/runner/lookup_plugins/subelements.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/runner/lookup_plugins/subelements.py b/lib/ansible/runner/lookup_plugins/subelements.py index fef0f05575..f33aae717d 100644 --- a/lib/ansible/runner/lookup_plugins/subelements.py +++ b/lib/ansible/runner/lookup_plugins/subelements.py @@ -39,6 +39,7 @@ class LookupModule(object): if isinstance(terms[0], dict): # convert to list: if terms[0].get('skipped',False) != False: + # the registered result was completely skipped return [] elementlist = [] for key in terms[0].iterkeys(): @@ -51,6 +52,9 @@ class LookupModule(object): for item0 in elementlist: if not isinstance(item0, dict): raise errors.AnsibleError("subelements lookup expects a dictionary, got '%s'" %item0) + if item0.get('skipped',False) != False: + # this particular item is to be skipped + continue if not subelement in item0: raise errors.AnsibleError("could not find '%s' key in iterated item '%s'" % (subelement, item0)) if not isinstance(item0[subelement], list):