Closed jamincollins closed 10 months ago
Bonus points would be a way to allow progress updates from the subprocess to display.
Try using sh.sudo
directly:
sh.sudo.dd("bs=4M", f"of=/dev/{lvm_group}/{name}",
_in=sh.sudo.rbd("export", "--no-progress", volume, "-", _piped=True)
)
The sh.contrib.sudo
will always ask for a password every time it is executed.
but it never seems to make progress.
Are you sure it isn't just slow? Also, if you know progress is printed on stderr, you can redirect the output to sys.stderr
or a callback.
If it is progressing but is just slow, there may be some more switches we can flip to make it faster. Let me know.
Closing. Feel free to reopen if you have time to get back to this issue.
I can't seem to find a way to handle piping a sudo process to another sudo process, as both need to ask for a password.
For example:
I've also tried running the entire script as root with the following, but it never seems to make progress.
For now, I'm placing the above logic in a separate shell script that
sh
executes.