summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkos Vandra <avandra@whitepages.com>2015-01-25 14:51:01 +0100
committerJames Cammarata <jimi@sngx.net>2015-02-17 14:00:07 -0600
commit8150b14d8d4a1d49a80ff9b4ace660ba4d03141e (patch)
tree06ff1d5d2447431e89d35463f8f6410b9882431e
parentf32e9f0e54c7ef532c8e94350b3f4d24f795e270 (diff)
downloadansible-8150b14d8d4a1d49a80ff9b4ace660ba4d03141e.tar.gz
fixes #10086
Conflicts: v2/ansible/plugins/shell/sh.py
-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 c43a8e725c..816b4c301c 100644
--- a/lib/ansible/runner/shell_plugins/sh.py
+++ b/lib/ansible/runner/shell_plugins/sh.py
@@ -98,7 +98,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; print(hashlib.sha1(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path), # Python > 2.4 (including python3)
+ "(%s -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\nwith open(\"%s\", \"rb\") as afile:\n\tbuf = afile.read(BLOCKSIZE)\n\twhile len(buf) > 0:\n\t\thasher.update(buf)\n\t\tbuf = afile.read(BLOCKSIZE)\n\n\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path), # Python > 2.4 (including python3)
"(%s -c 'import sha; print(sha.sha(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path), # Python == 2.4
]