[collect] SosNode._format_cmd local node return without sudo/su when already root. #3838
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #3827
Resolves: #3828
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines
Passing Tests
sudo sos collect --batch --nopasswd-sudo --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
sos collect --batch --nopasswd-sudo --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
sudo sos collect --batch --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
sudo sos collect --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
sos collect --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
sudo sos collect --password --ssh-user project-user --nodes 192.168.124.121
sudo sos collect --nopasswd-sudo --password --ssh-user project-user --nodes 192.168.124.121
sos collect --password --ssh-user project-user --nodes 192.168.124.121
sos collect --nopasswd-sudo --password --ssh-user project-user --nodes 192.168.124.121
I did not think of any use cases that need/expect to run
sudo -S {cmd}
orsu -c {quote(cmd)}
when already the root user, or already running sudo etc.. However, this change would prevent that from happening on the local node executingsos collect
.I don't believe this introduces any unwanted changes. However, please let me know if there are any other test case combinations you would like performed to feel comfortable before merging.