Looking at the import section that fails, should it be like the md5
exception handling and handle the second failure ?
--- basic.py.bak 2014-11-27 20:35:07.000000000 -0500
+++ basic.py 2014-11-27 20:34:31.000000000 -0500
@@ -90,8 +90,10 @@
from hashlib import sha1 as _sha1
HAVE_HASHLIB=True
except ImportError:
- from sha import sha as _sha1
-
+ try:
+ from sha import sha as _sha1
+ except ImportError:
+ _sha = None
try:
from hashlib import md5 as _md5
On Thursday, November 27, 2014 2:30:40 PM UTC-5, mike tancsa wrote:
>
> Hi,
> On a few of my FreeBSD boxes I want to start managing via Ansible, I have
> run into a python deprecation error / warning I am not sure how to deal
> with. I am using what is in the git repo, not the older version from the
> ports.
>
> % ansible -m setup site0340
> ps0340snmp.station.pioneer.ca | FAILED >> {
> "failed": true,
> "msg":
> "/tmp/.ansible/tmp/ansible-tmp-1417115114.01-177476480407452/setup:234:
> DeprecationWarning: the sha module is deprecated; use the hashlib module
> instead\r\n from sha import sha as _sha1\r\nTraceback (most recent call
> last):\r\n File
> \"/tmp/.ansible/tmp/ansible-tmp-1417115114.01-177476480407452/setup\", line
> 234, in <module>\r\n from sha import sha as _sha1\r\n File
> \"/usr/local/lib/python2.6/sha.py\", line 10, in <module>\r\n from
> hashlib import sha1 as sha\r\n File
> \"/usr/local/lib/python2.6/hashlib.py\", line 136, in <module>\r\n md5 =
> __get_builtin_constructor('md5')\r\n File
> \"/usr/local/lib/python2.6/hashlib.py\", line 63, in
> __get_builtin_constructor\r\n import _md5\r\nImportError: No module
> named _md5\r\n",
> "parsed": false
> }
>
> What is the best way to work around this ?
> % ansible --version
> ansible 1.9
> configured module search path = /usr/local/share/ansible
>
--
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/09b6000d-4f95-4dd8-99b5-399ae8957577%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.