summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Hadfield <jon@lessknown.co.uk>2015-02-04 13:46:49 +0000
committerJames Cammarata <jimi@sngx.net>2015-02-17 14:20:34 -0600
commit31978121e19518f7f5d4e0005982367b989c3a3f (patch)
treeab1826ae7af99f9f878d2b955a9a2a2afcf970d7
parent2013d95e53813e6d53dab4c501bef075019e4b3f (diff)
downloadansible-31978121e19518f7f5d4e0005982367b989c3a3f.tar.gz
correct typo that breaks hashing on python 2.4.
-rw-r--r--lib/ansible/runner/shell_plugins/sh.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/runner/shell_plugins/sh.py b/lib/ansible/runner/shell_plugins/sh.py
index 5462429743..d8f1efeb12 100644
--- a/lib/ansible/runner/shell_plugins/sh.py
+++ b/lib/ansible/runner/shell_plugins/sh.py
@@ -99,7 +99,7 @@ class ShellModule(object):
test = "rc=flag; [ -r \'%(p)s\' ] || rc=2; [ -f \'%(p)s\' ] || rc=1; [ -d \'%(p)s\' ] && rc=3; %(i)s -V 2>/dev/null || rc=4; [ x\"$rc\" != \"xflag\" ] && echo \"${rc}\"\' %(p)s\' && exit 0" % dict(p=path, i=python_interp)
csums = [
"(%s -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\nafile = open(\"%s\", \"rb\")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path), # Python > 2.4 (including python3)
- "(%s -c 'import sha; BLOCKSIZE = 65536; hasher = sha.sha1();\nafile = open(\"%s\", \"rb\")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path), # Python == 2.4
+ "(%s -c 'import sha; BLOCKSIZE = 65536; hasher = sha.sha();\nafile = open(\"%s\", \"rb\")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path), # Python == 2.4
]
cmd = " || ".join(csums)