From 1359bbee87038c35bb49d4fb80e1749184b72f08 Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 20 Apr 2015 12:49:25 -0400 Subject: [PATCH] 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. --- plugins/inventory/gce.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/inventory/gce.py b/plugins/inventory/gce.py index e77178c16b3..76e14f23012 100755 --- a/plugins/inventory/gce.py +++ b/plugins/inventory/gce.py @@ -72,6 +72,16 @@ Author: Eric Johnson 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_VERSION="v1"