correctd inventory_file to return full path

fixes #31294

(cherry picked from commit dbae704d3c)
pull/31343/head
Brian Coca 7 years ago
parent e9183f1966
commit 7d69946d42

@ -90,6 +90,7 @@ Ansible Changes By Release
* really turn off inventory caching, toggle will be added in 2.5
* for inventory sources, dont follow symlinks to calculate base directory, used for group/host_vars
* Port the uptime.py example script to the new inventory API.
* inventory_file variable again returns full path, not just basename
<a id="2.4"></a>

@ -19,7 +19,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
from ansible import constants as C
@ -187,7 +186,7 @@ class InventoryData(object):
h = Host(host, port)
self.hosts[host] = h
if self.current_source: # set to 'first source' in which host was encountered
self.set_variable(host, 'inventory_file', os.path.basename(self.current_source))
self.set_variable(host, 'inventory_file', self.current_source)
self.set_variable(host, 'inventory_dir', basedir(self.current_source))
else:
self.set_variable(host, 'inventory_file', None)

Loading…
Cancel
Save