Fix traceback with using GCE on EL6 with python-crypto2.6

This fix resolves an issue on EL6 systems where there may be multiple versions
of pycrypto installed.  EPEL provides both `python-crypto` and
`python-crypto2.6`.  These packages are co-installable.  However, modules
importing the `Crypto` library must specify which version to use, otherwise the
default will be used.

This change follows the same pattern established in `bin/ansible` for
specifying python library requirements.
This commit is contained in:
James Laska 2015-04-20 12:49:25 -04:00
parent d600c65095
commit 1359bbee87

View file

@ -72,6 +72,16 @@ Author: Eric Johnson <erjohnso@google.com>
Version: 0.0.1 Version: 0.0.1
''' '''
__requires__ = ['pycrypto>=2.6']
try:
import pkg_resources
except ImportError:
# Use pkg_resources to find the correct versions of libraries and set
# sys.path appropriately when there are multiversion installs. We don't
# fail here as there is code that better expresses the errors where the
# library is used.
pass
USER_AGENT_PRODUCT="Ansible-gce_inventory_plugin" USER_AGENT_PRODUCT="Ansible-gce_inventory_plugin"
USER_AGENT_VERSION="v1" USER_AGENT_VERSION="v1"