store.Inspect: fall back to ssh.config for SSH port#4592
Merged
AkihiroSuda merged 1 commit intolima-vm:masterfrom Feb 16, 2026
Merged
store.Inspect: fall back to ssh.config for SSH port#4592AkihiroSuda merged 1 commit intolima-vm:masterfrom
AkihiroSuda merged 1 commit intolima-vm:masterfrom
Conversation
0643cb4 to
8bcfe35
Compare
When the host agent is unavailable, the SSH local port remains 0 because Inspect can only retrieve it from the host agent. Extract the port from the instance's ssh.config file as a fallback; this file persists after the host agent dies and contains the port assigned at startup. Fixes lima-vm#4583 Signed-off-by: Jan Dubois <jan.dubois@suse.com>
8bcfe35 to
c1cdcb8
Compare
AkihiroSuda
reviewed
Feb 16, 2026
| } | ||
|
|
||
| // sshPortFromConfig extracts the SSH port from an ssh config file. | ||
| func sshPortFromConfig(configPath string) (int, error) { |
Member
There was a problem hiding this comment.
(This function is not robust to cover a config with multiple host entries, but we do not need to care about it for Lima-generated config files, at least with the current version)
AkihiroSuda
reviewed
Feb 16, 2026
| } | ||
|
|
||
| // sshPortFromConfig extracts the SSH port from an ssh config file. | ||
| func sshPortFromConfig(configPath string) (int, error) { |
Member
There was a problem hiding this comment.
nit: This could be easier for unit testing
Suggested change
| func sshPortFromConfig(configPath string) (int, error) { | |
| func sshPortFromConfig(config []byte) (int, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When the host agent is unavailable, the SSH local port remains 0 because
Inspectcan only retrieve it from the host agent. Extract the port from the instance'sssh.configfile as a fallback; this file persists after the host agent dies and contains the port assigned at startup.Fixes #4583