Wrap crypto.hash imports with try/except
This commit is contained in:
parent
0f962dba14
commit
6740a1f342
1 changed files with 5 additions and 1 deletions
|
@ -30,7 +30,11 @@ from binascii import hexlify
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
from ansible import constants as C
|
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
|
# Counter import fails for 2.0.1, requires >= 2.6.1 from pip
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue