From a04d0f485b0014dc25add18d0b80ab0180fcb408 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 22 Dec 2016 12:39:31 -0500 Subject: [PATCH] warn when examined group_vars is not dir (cherry picked from commit 6f5ecb7efd6fc99a0279051e5b06d118376ea819) --- lib/ansible/inventory/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 7a08029055..1f0317c454 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -781,7 +781,10 @@ class Inventory(object): path = os.path.realpath(os.path.join(basedir, 'group_vars')) found_vars = set() if os.path.exists(path): - found_vars = set(os.listdir(to_text(path))) + if os.path.isdir(path): + found_vars = set(os.listdir(to_text(path))) + else: + display.warning("Found group_vars that is not a directory, skipping: %s" % path) return found_vars def _find_host_vars_files(self, basedir):