Allow vault ssh to work with single ssh args like -v #4825
Merged
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.
My changes in #4710 did not take into account single ssh arguments like
-v
for verbosity. When running a command with one of these arguments it would then attempt to parse the next argument as the value.A simple example of where this failed.
In this case it hit
-v
and decided that the next value would be the value for this arg. Since-v
isn't interesting for vault it skipped it and continued parsing the ssh command. Then the next bare argument was taken to be the hostname when it was actually supposed to be the command.I really wish there was a clean solution to this which didn't involve the hardcoded list of single ssh args. The ssh client code for parsing the args is around 500 lines long and I can't see a way to programatically parse the hostname without knowing which args have values and which don't.
One potential solution for the future would be to move all ssh parsing logic out of vault and into a separate library. Right now I feel it is important to fix the current bug however this might be a good answer to solving this cleanly.