From 60451c20ab0cb8293a1ba51b48c600819a676626 Mon Sep 17 00:00:00 2001 From: Michal Mach Date: Wed, 14 May 2014 22:36:32 +0200 Subject: [PATCH] Fix known_hosts.py to work on older versions of python --- lib/ansible/module_utils/known_hosts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index 62600d7b4d..522b34302a 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -27,7 +27,12 @@ # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import hmac -from hashlib import sha1 + +try: + from hashlib import sha1 +except ImportError: + import sha as sha1 + HASHED_KEY_MAGIC = "|1|" def add_git_host_key(module, url, accept_hostkey=True, create_dir=True):