pstadler / flightplan

Run sequences of shell commands against local and remote hosts.
https://www.npmjs.com/package/flightplan
MIT License
1.82k stars 116 forks source link

local.transfer filesToCopy path problem #151

Closed zhujun24 closed 7 years ago

zhujun24 commented 8 years ago

I wanna rsync one file to server, filesToCopy is ['../aaa.conf'] , when local.transfer(filesToCopy, remoteDir) ,they will be error failed: No such file or directory,because that rsync file path is current path connect filesToCopy,just like /code/project/test/../aaa.conf not /code/project/aaa.conf

DuanPengfei commented 7 years ago

I also with the same problem. local.transfer('../app/', REMOTE_PROJECT_CODE_PATH); got error rsync: link_stat "/tt/deploy/app" failed: No such file or directory (2), the correct path should be /tt/app not /tt/deploy/app, the flightplan.js in the /tt/deploy/ folder.

pstadler commented 7 years ago

Hey there.

Unfortunately this is limitation of rsync. You could try to work with absolute paths or create a tar file (probably in /tmp), transfer this to the remote servers, untar it and continue from there. This has several advantages over copying a bunch of small files.

DuanPengfei commented 7 years ago

By the way, why use the tmp file instead of direct upload origin file? What are the benefits of doing so?

pstadler commented 7 years ago

This is the only way to ensure compatibility with various operating systems and rsync versions. See here

zhujun24 commented 7 years ago

Copy file instead of origin file to transfer is hack, but it's the only way to resolve it.