From 4e14b7b783f880eed20fecd936c6e958677b8068 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 26 Jul 2016 08:24:47 -0400 Subject: [PATCH] warn when searching for an empty string or null --- lib/ansible/parsing/dataloader.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/parsing/dataloader.py b/lib/ansible/parsing/dataloader.py index c2c9bd63f2..abc8c55bb2 100644 --- a/lib/ansible/parsing/dataloader.py +++ b/lib/ansible/parsing/dataloader.py @@ -281,7 +281,9 @@ class DataLoader(): find one file in first path in stack taking roles into account and adding play basedir as fallback ''' result = None - if source.startswith('~') or source.startswith(os.path.sep): + if not source: + display.warning('Invalid request to find a file that matches an empty string or "null" value') + elif source.startswith('~') or source.startswith(os.path.sep): # path is absolute, no relative needed, check existence and return source test_path = to_bytes(unfrackpath(source),errors='strict') if os.path.exists(test_path):