Open creynders opened 9 years ago
Just had a deeper look at the code and if I'm not mistaken that's definitely not possible ATM.
Looking at https://github.com/pstadler/flightplan/blob/master/lib/transport/shell.js#L117 I'd say the options
are passed to child_process.exec
, i.e. it only allows cwd
, env
, ... however I'd like to suggest to make it symmetrical to the other methods and only pass exec
options to child_process.exec
.
The documentation for transport#exec
says:
Options passed with exec will be forwarded to either of these functions.
It would make more sense if it was the same for transport#transfer
.
And in that case the options object could be used for setting the flags for rsync for instance, something like this:
transport.transfer( files, plan.runtime.options.dest, {
"copy-links" : true,
exclude: ".git",
exec : {
cwd: './app'
}
} );
Or enveloped for easier plucking:
transport.transfer( files, plan.runtime.options.dest, {
transfer:{
"copy-links" : true,
exclude: ".git",
},
exec : {
cwd: './app'
}
} );
P.S.: obviously it would be even more fantastic if exclude
would be parsed in the same way files
is.
I agree, this makes sense.
Also consider to pass the directory if this makes any sense (see #107)
Take this into account: #109
This is more than just an enhancement. I just tried to use local.transfer from a mac to a Ubuntu VPS. Ownership of files were set to mac user and group, which made no sense on the remote. Furthermore, the parent directory (the home dir) were now owned by the local user, which caused SSH to deny any further connections, effectively shutting me out.
I feel this must have been addressed before, and perhaps I am not aware of all option flags?
@kparkov My workaround was using local.exec
instead of local.transfer
.
For example:
local.exec('rsync -rz --chmod=ugo=rwX --delete --exclude \'shared\' ./dist/ ' + host.username + '@' + host.host + ':' + plan.runtime.options.projectDir + 'htdocs/', {silent: true});
That's definitely the way to go. rsync is a nightmare to utilize in the way that flightplan does. I'm thinking about replacing it with sftp.
Hi @pstadler ! When you plan to do something with that one? In my case I need pass -r
parameter because I have ~18k files (semi-size symfony2 project) and when I do find
to find proper file names - fly is crashing. I want to pass only dirnames for rsync.
Pretty busy at the time, but I'm open for pull requests 👍
FYI: dirty hack in flightplan.js (in project)
local._context.hosts.map(function (host) {
local.exec(
'rsync -azr --progress --delete-after * .symfony.ini --rsh="ssh -p 22" '
+ host.username + '@' + host.host + ':' + getRemoteDir(plan.runtime.target + '/repo/')
);
});```
works 👌
Maybe I just overlooked it in the documentation, but it's not entirely clear how I could pass flags to rsync when transferring files. E.g. I'd like to copy over symlink contents and not the symlinks themselves, this means I have to be able to set the
-L
flag.I've tried:
and
But to no avail. Is this not possible using the transfer wrapper, do I need to use
transport.exec
instead?