Safer parameter strings for rsync command. Wrap filename in qoutes.

This commit is contained in:
2019-05-01 10:50:28 +02:00
parent ce2a319447
commit 8030cf5b36

View File

@@ -9,9 +9,9 @@ from utils import getConfig
def getFiles(path, host=None, user=None):
logger.info('Getting filenames from path: {}'.format(path))
if (host and user):
cmd = 'ssh {}@{} ls {}'.format(user, host, path)
cmd = "ssh {}@{} ls '{}'".format(user, host, path)
else:
cmd = 'ls {}'.format(path)
cmd = "ls '{}'".format(path)
contents = check_output(cmd, shell=True)