welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 167 forks source link

rsync_options does not keep necessary quotes for needed option #392

Closed freedog96150 closed 7 years ago

freedog96150 commented 7 years ago

Been trying to figure out how to get the rsync_options section of the Movefile to respect the necessary quotes for an rsync option. What I need is as below:

--rsync-path="sudo rsync" or alternately --rsync-path='sudo rsync'

I have tried single quotes, double quotes and escaping with backslashes. In all configurations attempted, the final output reverts to --rsync-path=sudo rsync which causes an error when run. If I copy/paste the command, add the needed quotes, the command runs as expected. I am sure that I am missing something easy that will allow me to set this parameter in the Movefile and have it properly inserted. Any suggestions?

freedog96150 commented 7 years ago

Should have included the relevant portion of my Movefile.

ssh:
  host: "1.2.3.4"
  user: "someuser"
  rsync_options: "--protect-args --verbose --rsync-path='sudo rsync'" 
alessandro-fazzi commented 7 years ago

This is probably a bug: it's not a simple task to manage all our levels of escaping actually.

Just one try:

rsync_options: "--protect-args --verbose --rsync-path=sudo\\\\ rsync" 

I know it sounds funny :) but let me know

freedog96150 commented 7 years ago

Yes. worked. Did not think to escape the escape for the escape of the escaped space. I did try one variation previously, but missed one critical escape. 4 was the magic number. Thanks!

Is this staying as a bug/fix? I think it would be easier to just include some additional wiki information on properly escaping spaces on the Movefile.

alessandro-fazzi commented 7 years ago

@freedog96150 , could you try to update to version 2.0.1? It shuld fix the problem using

--rsync-path='sudo rsync'

as expected. Thanks in advance.

P.S.: as a reference the problem was not directly in wordmove, but in photocopier gem; this https://github.com/welaika/photocopier/commit/ae80a921ba8e8822e3cc67cac3dd965f3c24cb2f update should solve the bug.

freedog96150 commented 7 years ago

Finally got around to updating and testing. Seems to work as expected now without all the crazy escaping. Thanks!