1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Check one more skipped scenario in with_subelements.

This commit is contained in:
Michael DeHaan 2013-10-09 17:14:18 -04:00
parent 9124ebb4f1
commit 3f968ff46a

View file

@ -39,6 +39,7 @@ class LookupModule(object):
if isinstance(terms[0], dict): # convert to list: if isinstance(terms[0], dict): # convert to list:
if terms[0].get('skipped',False) != False: if terms[0].get('skipped',False) != False:
# the registered result was completely skipped
return [] return []
elementlist = [] elementlist = []
for key in terms[0].iterkeys(): for key in terms[0].iterkeys():
@ -51,6 +52,9 @@ class LookupModule(object):
for item0 in elementlist: for item0 in elementlist:
if not isinstance(item0, dict): if not isinstance(item0, dict):
raise errors.AnsibleError("subelements lookup expects a dictionary, got '%s'" %item0) 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: if not subelement in item0:
raise errors.AnsibleError("could not find '%s' key in iterated item '%s'" % (subelement, item0)) raise errors.AnsibleError("could not find '%s' key in iterated item '%s'" % (subelement, item0))
if not isinstance(item0[subelement], list): if not isinstance(item0[subelement], list):