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

Throw an error if with_first_found finds no files by default

Fixes #9976
This commit is contained in:
James Cammarata 2015-07-01 16:09:05 -04:00
parent b11e69f3d0
commit 9341148f04

View file

@ -123,7 +123,7 @@ import os
from jinja2.exceptions import UndefinedError from jinja2.exceptions import UndefinedError
from ansible.errors import AnsibleUndefinedVariable from ansible.errors import AnsibleLookupError, AnsibleUndefinedVariable
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
from ansible.template import Templar from ansible.template import Templar
from ansible.utils.boolean import boolean from ansible.utils.boolean import boolean
@ -202,5 +202,5 @@ class LookupModule(LookupBase):
if skip: if skip:
return [] return []
else: else:
return [None] raise AnsibleLookupError("No file was found when using with_first_found. Use the 'skip: true' option to allow this task to be skipped if no files are found")