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.
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
expanded ssh_config parameters for qemu+ssh uri option #1059
expanded ssh_config parameters for qemu+ssh uri option #1059
Changes from 24 commits
ba090fc
19893fc
94ae671
76ed8d0
7dacf0b
7273b7d
4abb01a
f190d80
329a202
c1e4fbf
100f82b
e203600
d47102d
1516454
7caaf18
ad51d68
6754108
60cf3f1
060987d
31af282
3680059
615b189
dec8f23
86ac64d
4c8eb53
0da4763
186e5ac
6f1618f
fe60b2c
2c1c934
d1aa5a8
2e39b4e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the err != nil, it is silently ignored instead of returning. My suggestion: if err != nil, return, then only condition on proxy being non empty to execute the recursion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear, can you rephrase please? Did you mean "if the error == nil" ?
Are you perhaps saying there can be a condition in which both
bastion
anderr
are nil?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that
proxy, err = sshcfg.Get(target, "ProxyJump")
can return error, and in that case you would continue with the flow, instead of returning the function. Yes you would skip dialing the proxy (assuming it returned empty string in addition to the error), but the flow would continue anyway.Wouldn't it make more sense to return early if
proxy, err = sshcfg.Get(target, "ProxyJump")
returns an error. And then you execute the code that dials the proxy only testing forproxy != ""
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProxyJump
can be absent, in which caseGet()
(as opposed toGetStrict()
)returns empty string as per sshconfig docs. This isn't an error per-se as it simply means there's no proxy. This covers case 1 of the conditional on line 250, which iserr == nil
andproxy == ""
. In this case, the flow should proceed without proxy.The second case is if the sshconfig file had a parse error (i.e.
err != nil
) and we don't care aboutproxy
. In this case, it means that the sshconfig file couldn't be parsed. Expected behaviour in those circumstances (e.g. when using ssh from cli) is to simply honor the command itself and ignore any ssh_config directives altogether, which in this case corresponds to a flow-through without Proxy.I think there's a case to be made that (maybe) the very first successful call to
sshcfg.Get()
guarantees that every subsequent call is successful. However, I'd not feel comfortable breaking the abstraction and depending on this behaviour: it would make the code very convoluted and introduce race conditions (i.e. ifssh_config
gets touched during this setup).Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmacvicar see above for my thoughts on this codepath.