-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Describe the bug
If I want to rsync with a nice setting of 19, I would do:
rsync --rsync-path='nice -n 19 rsync' <src> <destination>
If I want to run this with sudo, I would do:
rsync --rsync-path='sudo nice -n 19 rsync' <src> <destination>
The way the module is currently written, if Rex::is_sudo
is true, then --rsync-path
gets set to sudo rsync
. See https://github.com/RexOps/Rex/blob/master/lib/Rex/Commands/Rsync.pm#L163
This would possibly stomp on any --rsync-path setting I set in the options to the Rex sync()
command like in the first example above: nice -n 19 rsync
.
How to reproduce it
Run this in a Rex task:
sudo TRUE;
sync($source, $dest, { parameters => '--rsync-path="nice -n 19 rsync"' })
Expected behavior
Something like following command should be run on the remote machine, with --rsync-path
only appearing once and sudo
coming before the nice
command and option:
rsync $source $dest --rsync-path='sudo nice -n 19 rsync'
Actual behavior
Instead, the following command gets run with --rsync-path
appearing twice:
rsync $source $dest --rsync-path='nice -n 19 rsync' --rsync-path='sudo rsync'