Repository navigation
fix: fall back to another common SSH key type when the configured default is missing - #1043
Merged
Merged
Conversation
…ault is missing onctl.yaml defaults ssh.publicKey/privateKey to ~/.ssh/id_rsa(.pub), so onctl up fails outright on machines that only have an id_ed25519 key pair. getSSHKeyFilePaths now falls back to id_ed25519, id_ecdsa, or id_rsa (in that order) in the same directory when the configured default doesn't exist. Explicit -k/filename values are unaffected.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bad5767a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… is missing Previously only a missing public key triggered the fallback search, so a stale public key alongside a missing private key (or vice versa) skipped fallback and left ssh/deploy/create using an unreadable configured path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfPLLLB6AfoUDuBVWMuN8F
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.
Summary
onctl.yamldefaultsssh.publicKey/ssh.privateKeyto~/.ssh/id_rsa(.pub), soonctl upfails outright (open .../id_rsa.pub: no such file or directory) on machines that only have anid_ed25519key pair.getSSHKeyFilePathsnow falls back to another common key type (id_ed25519,id_ecdsa,id_rsa, in that priority order) in the same directory when the configured default doesn't exist on disk.-k/filename values are untouched — this fallback only applies to the config-driven default, so explicit user intent still fails loud if the file is missing.internal/files/init/onctl.yamltemplate.Test plan
go build ./...go test ./cmd/... -run TestGetSSHKeyFilePaths— new fallback test + existing explicit-filename tests passgolangci-lint run ./cmd/...— 0 issuesTestReadConfig_NoConfigDirectory,TestCreateFlagsBindToViper) also fail identically onmain(environment/config-dependent, unrelated to this change)