mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #2582 from blair/inventory-scripts-not-in-path
Fix for inventory scripts with no path prefix that are in CWD.
This commit is contained in:
commit
2b58145599
1 changed files with 5 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#############################################
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import ansible.constants as C
|
||||
from ansible.inventory.host import Host
|
||||
|
@ -29,7 +30,10 @@ class InventoryScript(object):
|
|||
|
||||
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" ]
|
||||
try:
|
||||
sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
|
Loading…
Reference in a new issue