Commit 9341148f by James Cammarata

Throw an error if with_first_found finds no files by default

Fixes #9976
parent b11e69f3
......@@ -123,7 +123,7 @@ import os
from jinja2.exceptions import UndefinedError
from ansible.errors import AnsibleUndefinedVariable
from ansible.errors import AnsibleLookupError, AnsibleUndefinedVariable
from ansible.plugins.lookup import LookupBase
from ansible.template import Templar
from ansible.utils.boolean import boolean
......@@ -202,5 +202,5 @@ class LookupModule(LookupBase):
if skip:
return []
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")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment