Resolve dynamic inventory libs through symlink

The new dynamic inventory lib path appending is broken when
dynamic_inventory is being called through a symlink[1].

This will resolve the correct, real path of the
dynamic_inventory.py script even if it is being executed
via a symlink, and then add the correct path to the libs.

[1]: https://github.com/Logan2211/openstack-ansible-overlay/tree/master/overlay/playbooks/inventory

Change-Id: I2594ab833e074c9727f051f061bd4590eaf0264f
This commit is contained in:
Logan V 2016-11-04 12:20:54 -05:00
parent 0efdb3bd67
commit d1d034159a

View File

@ -19,7 +19,7 @@ import argparse
import os
import sys
current_path = os.path.abspath(os.path.dirname(__file__))
current_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
lib_path = os.path.join(current_path, '..', '..', 'lib')
sys.path.append(lib_path)