drush
drush copied to clipboard
how to define rsync options in drush.yml
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?
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
What about:
command:
core:
rsync:
suffix:
chmod: 'ugo=rwX'
So, adding support for a 'suffix' key. ping @greg-1-anderson.
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?
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, 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?
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?
Same issue here, I need to define omit-dir-times. Is there any way for that?