diff options
author | Jon Hadfield <jon@lessknown.co.uk> | 2015-02-04 13:46:49 +0000 |
---|---|---|
committer | Jon Hadfield <jon@lessknown.co.uk> | 2015-02-04 13:46:49 +0000 |
commit | 6874f5056d570b1361498a18ee54388b10b17296 (patch) | |
tree | 7c700fbb901e5fcb0ccaef04959b08d07f576950 | |
parent | 019f74dcedc598c31cb7109d82768e617115a232 (diff) | |
download | ansible-6874f5056d570b1361498a18ee54388b10b17296.tar.gz |
correct typo that breaks hashing on python 2.4.
-rw-r--r-- | lib/ansible/runner/shell_plugins/sh.py | 2 |
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) |