drush icon indicating copy to clipboard operation
drush copied to clipboard

how to define rsync options in drush.yml

Open Schnitzel opened this issue 6 years ago • 8 comments

I'm trying to add some rsync options in the drush.yml

I tried with

command:
  core:
    rsync:
      options:
        chmod: 'ugo=rwX'

but it's not working. While directly via

drush -d rsync @self:%files @lagoon.migration:%files -- --chmod=ugo=rwX

it works.

I assume the problem is because it needs -- before the options.

Any idea how that works?

Schnitzel avatar Apr 01 '18 23:04 Schnitzel

Yeah, -- converts everything after it from being interpreted as arguments rather than options. The Drush rsync command passes all of its extra arguments on to the shell rsync command that it exec's.

The consolidation/config feature to define additional command options in configuration does not work for additional arguments. The reason for this is that if an argument was defined in configuration, there would be no clear way to override or remove it.

Perhaps this behavior could be extended to include settings for additional options: things that appear after a -- in the command line that themselves also start with - or --. Ideas about exactly how this should work would be welcome. (n.b. this setting should be taken from somewhere other than command.x.y.options.)

Strictly speaking, this would be a feature request for https://github.com/consolidation/config

greg-1-anderson avatar Apr 02 '18 01:04 greg-1-anderson

What about:

command:
  core:
    rsync:
      suffix:
        chmod: 'ugo=rwX'

weitzman avatar Apr 02 '18 03:04 weitzman

So, adding support for a 'suffix' key. ping @greg-1-anderson.

weitzman avatar Apr 04 '18 19:04 weitzman

Still not sure that we have 100% identified how this should behave. For example, what if the current drush.yml was configured as above, and the command line was:

drush -rsync @self:%files @lagoon.migration:%files -- --chmod=ugo=r

Would that result in rsync --chmod=ugo=r or rsync --chmod=ugo=rxW --chmod=ugo=r?

What if the configuration was exclude: foo and the commandline had --exclude=bar? If the flags are both included, how would you get rid of --exclude=--foo if you didn't want it?

greg-1-anderson avatar Apr 04 '18 19:04 greg-1-anderson

I understand your concerns @greg-1-anderson, but I feel it's a bit over-engineered. Not many people use fancy rsync commands (I think)

in the upper example I would expect

rsync --chmod=ugo=rxW --chmod=ugo=r

if it's well documented I think people will be happy

Schnitzel avatar Apr 04 '18 21:04 Schnitzel

@Schnitzel, I'm with @greg-1-anderson on this. It is common that projects have drush .yml files inside it, so you can do a release to an Acceptation or Test environment with a release tool like Jenkins. All drush commands are executed but the rsync command doesn't include the --delete option right now.

Is anyone getting further with this issue?

Krilo89 avatar Nov 12 '18 17:11 Krilo89

Are boolean options supported? The following config

command:
  core:
    rsync:
      options:
        exclude-paths: 'stats:error'

... adds --exclude="stats" --exclude="error" to the command, but

command:
  core:
    rsync:
      options:
        delete: true

does absolutely nothing.

Where is this stuff documented?

rudolfbyker avatar Nov 25 '21 11:11 rudolfbyker

Same issue here, I need to define omit-dir-times. Is there any way for that?

Defcon0 avatar Sep 16 '22 12:09 Defcon0