From 6740a1f342a894a0c7cdb0fab434f1bceaf03583 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 10 Mar 2014 19:43:39 -0400 Subject: [PATCH] Wrap crypto.hash imports with try/except --- lib/ansible/utils/vault.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/vault.py b/lib/ansible/utils/vault.py index 118f579005..6a714fcc85 100644 --- a/lib/ansible/utils/vault.py +++ b/lib/ansible/utils/vault.py @@ -30,7 +30,11 @@ from binascii import hexlify from binascii import unhexlify from ansible import constants as C -from Crypto.Hash import SHA256, HMAC +try: + from Crypto.Hash import SHA256, HMAC + HAS_HASH = True +except ImportError: + HAS_HASH = False # Counter import fails for 2.0.1, requires >= 2.6.1 from pip try: