1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #2745 from sfromm/issue2742

Fix test so that it is /bin/sh compliant (issue #2742)
This commit is contained in:
Michael DeHaan 2013-04-22 16:23:26 -07:00
commit f9f1d5ee42

View file

@ -586,11 +586,9 @@ class Runner(object):
''' takes a remote md5sum without requiring python, and returns 0 if no file '''
path = pipes.quote(path)
test = ('if [ ! -e \"%s\" ]; then rc=0;'
'elif [ -d \"%s\" ]; then rc=3;'
'elif [ ! -f \"%s\" ]; then rc=1;'
'elif [ ! -r \"%s\" ]; then rc=2;'
'else rc=0; fi') % ((path,) * 4)
# The following test needs to be SH-compliant. BASH-isms will
# not work if /bin/sh points to a non-BASH shell.
test = "rc=0; [ -r \"%s\" ] || rc=2; [ -f \"%s\" ] || rc=1; [ -d \"%s\" ] && rc=3" % ((path,) * 3)
md5s = [
"(/usr/bin/md5sum %s 2>/dev/null)" % path, # Linux
"(/sbin/md5sum -q %s 2>/dev/null)" % path, # ?