Commit 2b581455 by Michael DeHaan

Merge pull request #2582 from blair/inventory-scripts-not-in-path

Fix for inventory scripts with no path prefix that are in CWD.
parents 94d189bc 36b3fc3a
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
############################################# #############################################
import os
import subprocess import subprocess
import ansible.constants as C import ansible.constants as C
from ansible.inventory.host import Host from ansible.inventory.host import Host
...@@ -29,7 +30,10 @@ class InventoryScript(object): ...@@ -29,7 +30,10 @@ class InventoryScript(object):
def __init__(self, filename=C.DEFAULT_HOST_LIST): def __init__(self, filename=C.DEFAULT_HOST_LIST):
self.filename = filename # Support inventory scripts that are not prefixed with some
# path information but happen to be in the current working
# directory when '.' is not in PATH.
self.filename = os.path.abspath(filename)
cmd = [ self.filename, "--list" ] cmd = [ self.filename, "--list" ]
try: try:
sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment