warn when examined group_vars is not dir

(cherry picked from commit 6f5ecb7efd)
This commit is contained in:
Brian Coca 2016-12-22 12:39:31 -05:00
parent 7683715caf
commit a04d0f485b

View file

@ -781,7 +781,10 @@ class Inventory(object):
path = os.path.realpath(os.path.join(basedir, 'group_vars')) path = os.path.realpath(os.path.join(basedir, 'group_vars'))
found_vars = set() found_vars = set()
if os.path.exists(path): 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 return found_vars
def _find_host_vars_files(self, basedir): def _find_host_vars_files(self, basedir):