Between Ansible 1.5.3 and 1.6.6, lib/ansible/module_utils/known_hosts.py added
from hashlib import sha1
which doesn't work on target hosts who only have Python 2.4.
The 'git' module uses this, and produces this stacktrace on a target RHEL
5 system:
Traceback (most recent call last):
File
"/home/ansible/.ansible/tmp/ansible-tmp-1406298245.3-265004186822038/git", line
1840, in ?
from hashlib import sha1
ImportError: No module named hashlib
If we modify known_hosts.py to just the import, like so:
+$ git diff -U0
diff --git a/lib/ansible/module_utils/known_hosts.py
b/lib/ansible/module_utils/known_hosts.py
index 62600d7..90620f7 100644
--- a/lib/ansible/module_utils/known_hosts.py
+++ b/lib/ansible/module_utils/known_hosts.py
@@ -30 +30,5 @@ import hmac
-from hashlib import sha1
+try:
+ from hashlib import sha1
+except ImportError:
+ pass
+
that solves our immediate problem, because we don't actually happen to
need to do anything with known_hosts right now, but that would presumably
break things that actually need to use sha1 from hashlib, so that's
probably not a real fix. :^)
-Josh ([email protected])
This email is intended for the person(s) to whom it is addressed and may
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use,
distribution, copying, or disclosure by any person other than the addressee(s)
is strictly prohibited. If you have received this email in error, please notify
the sender immediately by return email and delete the message and any
attachments from your system.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/21458.33423.536849.308170%40care.com.
For more options, visit https://groups.google.com/d/optout.