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

Quote remote md5 operations. Fixes #2368

This commit is contained in:
Michael DeHaan 2013-03-11 17:19:43 -04:00
parent e304cc3d8e
commit 298d64aa1d

View file

@ -546,6 +546,7 @@ class Runner(object):
def _remote_md5(self, conn, tmp, path): def _remote_md5(self, conn, tmp, path):
''' takes a remote md5sum without requiring python, and returns 0 if no file ''' ''' takes a remote md5sum without requiring python, and returns 0 if no file '''
path = pipes.quote(path)
test = "rc=0; [ -r \"%s\" ] || rc=2; [ -f \"%s\" ] || rc=1; [ -d \"%s\" ] && rc=3" % (path, path, path) test = "rc=0; [ -r \"%s\" ] || rc=2; [ -f \"%s\" ] || rc=1; [ -d \"%s\" ] && rc=3" % (path, path, path)
md5s = [ md5s = [
"(/usr/bin/md5sum %s 2>/dev/null)" % path, # Linux "(/usr/bin/md5sum %s 2>/dev/null)" % path, # Linux