From 26d5a17b5937798120ea23d0895bee82d59e8b50 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 6 Aug 2015 10:17:24 -0400 Subject: [PATCH] Make sure inventory loads files with non-relative paths This is a slightly different fix than we originally committed, but fixes the problem in a less invasive way (and I believe it's generally better that we don't deal with relative paths internally past this point) Fixes #11789 --- lib/ansible/inventory/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 2bcea0f3519..0edb4dc3862 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -660,11 +660,11 @@ class Inventory(object): # FIXME: these should go to VariableManager if group and host is None: # load vars in dir/group_vars/name_of_group - base_path = os.path.join(basedir, "group_vars/%s" % group.name) + base_path = os.path.realpath(os.path.join(basedir, "group_vars/%s" % group.name)) results = self._variable_manager.add_group_vars_file(base_path, self._loader) elif host and group is None: # same for hostvars in dir/host_vars/name_of_host - base_path = os.path.join(basedir, "host_vars/%s" % host.name) + base_path = os.path.realpath(os.path.join(basedir, "host_vars/%s" % host.name)) results = self._variable_manager.add_host_vars_file(base_path, self._loader) # all done, results is a dictionary of variables for this particular host.