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

sudo'ing with rsync probably stomps on --rysnc-path setting #1356

Open
sdondley opened this issue Jun 25, 2020 · 0 comments · May be fixed by #1369
Open

sudo'ing with rsync probably stomps on --rysnc-path setting #1356

sdondley opened this issue Jun 25, 2020 · 0 comments · May be fixed by #1369

Comments

@sdondley
Copy link
Contributor

sdondley commented Jun 25, 2020

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'

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

Successfully merging a pull request may close this issue.

1 participant