mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 18:07:33 -02:30
Use distutils find_executable instead of which
Fixes: #44 Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
committed by
Patrick Uiterwijk
parent
534fefd82f
commit
3816791aa4
@@ -19,6 +19,7 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
import distutils.spawn
|
||||||
import optparse
|
import optparse
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
@@ -316,10 +317,9 @@ class InventoryCLI(CLI):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import imp
|
import imp
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
with open(__file__) as f:
|
with open(__file__) as f:
|
||||||
imp.load_source('ansible.cli.inventory', __file__ + '.py', f)
|
imp.load_source('ansible.cli.inventory', __file__ + '.py', f)
|
||||||
ansible_path = subprocess.check_output(['which', 'ansible']).strip()
|
ansible_path = distutils.spawn.find_executable('ansible')
|
||||||
sys.argv[0] = 'ansible-inventory'
|
sys.argv[0] = 'ansible-inventory'
|
||||||
execfile(ansible_path)
|
execfile(ansible_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user