Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing flags to rsync #71

Open
creynders opened this issue Feb 4, 2015 · 11 comments
Open

Passing flags to rsync #71

creynders opened this issue Feb 4, 2015 · 11 comments

Comments

@creynders
Copy link

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:

  transport.transfer( files, plan.runtime.options.dest, {
    exec : {
      "copy-links" : true
    }
  } );

and

  transport.transfer( files, plan.runtime.options.dest, {
      "copy-links" : true
  } );

But to no avail. Is this not possible using the transfer wrapper, do I need to use transport.exec instead?

@creynders
Copy link
Author

Just had a deeper look at the code and if I'm not mistaken that's definitely not possible ATM.

@creynders
Copy link
Author

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.

@pstadler
Copy link
Owner

pstadler commented Feb 4, 2015

I agree, this makes sense.

@pstadler
Copy link
Owner

Also consider to pass the directory if this makes any sense (see #107)

@pstadler
Copy link
Owner

Take this into account: #109

@kparkov
Copy link

kparkov commented Mar 7, 2016

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?

@seybsen
Copy link

seybsen commented Mar 8, 2016

@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});

@pstadler
Copy link
Owner

pstadler commented Mar 8, 2016

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.

@noose
Copy link

noose commented May 14, 2016

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.

@pstadler
Copy link
Owner

Pretty busy at the time, but I'm open for pull requests 👍

@noose
Copy link

noose commented May 16, 2016

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 👌 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants