From 17dafaa1f07fbfd845bbb67f12b748beb0cb841a Mon Sep 17 00:00:00 2001 From: Sinisa Veseli <sveseli@aps.anl.gov> Date: Tue, 12 Apr 2016 18:49:21 +0000 Subject: [PATCH] fix for filenames that have columns, as well as those that start with a dash --- .../dm/common/processing/plugins/fileTransferPlugin.py | 10 +++++----- .../processing/plugins/rsyncFileTransferPlugin.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/python/dm/common/processing/plugins/fileTransferPlugin.py b/src/python/dm/common/processing/plugins/fileTransferPlugin.py index 25158a41..2c2228ac 100755 --- a/src/python/dm/common/processing/plugins/fileTransferPlugin.py +++ b/src/python/dm/common/processing/plugins/fileTransferPlugin.py @@ -34,15 +34,15 @@ class FileTransferPlugin(FileProcessor): self.start(src=srcUrl, dest=destUrl, templateInfo=fileInfo) def getSrcUrl(self, filePath, dataDirectory): - # Use relative path with respect to data directory as a source - srcUrl = os.path.relpath(filePath, dataDirectory) - return srcUrl + return filePath def getDestUrl(self, filePath, dataDirectory, storageHost, storageDirectory): + # Use relative path with respect to data directory as a source + srcUrl = os.path.relpath(filePath, dataDirectory) if self.dest: - destUrl = '%s' % (self.dest) + destUrl = '%s/%s' % (self.dest, srcUrl) else: - destUrl = '%s:%s' % (storageHost, storageDirectory) + destUrl = '%s:%s/%s' % (storageHost, storageDirectory, srcUrl) return destUrl def getSrcDirUrl(self, dataDirectory): diff --git a/src/python/dm/common/processing/plugins/rsyncFileTransferPlugin.py b/src/python/dm/common/processing/plugins/rsyncFileTransferPlugin.py index 4c0bac6c..0b44c3db 100755 --- a/src/python/dm/common/processing/plugins/rsyncFileTransferPlugin.py +++ b/src/python/dm/common/processing/plugins/rsyncFileTransferPlugin.py @@ -11,9 +11,9 @@ from dm.ds_web_service.api.dsRestApiFactory import DsRestApiFactory class RsyncFileTransferPlugin(FileTransferPlugin): - DEFAULT_COMMAND = 'rsync -arvlPR' - DIRECTORY_TRANSFER_COMMAND = 'rsync -arvlP' - DRY_RUN_COMMAND = 'rsync -arvlP' + DEFAULT_COMMAND = 'rsync -arvlPR --' + DIRECTORY_TRANSFER_COMMAND = 'rsync -arvlP --' + DRY_RUN_COMMAND = 'rsync -arvlP --dry-run --' def __init__(self, src=None, dest=None, command=DEFAULT_COMMAND, localMd5Sum=True, remoteMd5Sum=False, deleteOriginal=False, pluginMustProcessFiles=True, dependsOn=[]): FileTransferPlugin.__init__(self, command, src, dest, dependsOn=dependsOn) @@ -29,7 +29,7 @@ class RsyncFileTransferPlugin(FileTransferPlugin): storageDirectory = uploadInfo['storageDirectory'] storageHost = uploadInfo['storageHost'] dataDirectory = uploadInfo['dataDirectory'] - dryRunCommand = '%s --dry-run %s/ %s:%s' % (self.DRY_RUN_COMMAND, dataDirectory, storageHost, storageDirectory) + dryRunCommand = '%s %s/ %s:%s' % (self.DRY_RUN_COMMAND, dataDirectory, storageHost, storageDirectory) subprocess = DmSubprocess.getSubprocess(dryRunCommand) subprocess.run() lines = subprocess.getStdOut().split('\n') -- GitLab