Repository navigation
feat(cli): add -p short flag for --provider - #920
Merged
Merged
Conversation
…r.yaml Mirrors the Hetzner pass (#918) for Firecracker so the provider works with no .onctl YAML: - setDefaults(): firecracker.* defaults (kernelImage, rootfsImage, vcpuCount, memSizeMib, binPath, network.bridge/cidr, vm.username) matching the old firecracker.yaml. providerfirecracker.GetConfig still defaults these for direct package use; kernelImage/rootfsImage (which GetConfig left empty) now resolve to the conventional ~/.onctl paths with no config. - create flags --kernel-image, --rootfs-image, --fc-binary, --vcpu, --memory bound to the firecracker.* keys read by GetConfig; the generic --username also drives firecracker.vm.username. - Removed embedded internal/files/init/firecracker.yaml (`onctl init` no longer scaffolds it). - flags_defaults_test.go covers the new flags' existence, viper binding, and defaults. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
Renames the provider *identity* from `firecracker` to `fc` while keeping every reference to the Firecracker technology/binary intact: - Provider string: `--provider fc`, `ONCTL_CLOUD=fc`, cloudProviderList entry. - Config keys: firecracker.* -> fc.* (e.g. fc.kernelImage, fc.vcpuCount, fc.network.bridge, fc.vm.username). - Package internal/providerfirecracker -> internal/providerfc. - Exported Go types: ProviderFirecracker->ProviderFC, FirecrackerConfig->FCConfig, FirecrackerVMConfig->FCVMConfig, FirecrackerProcess->FCProcess, FirecrackerAPI->FCAPI (plus unexported helpers: firecrackerRequest->fcRequest, firecrackerStatus*->fcStatus*, defaultFirecrackerKernelArgs->defaultFCKernelArgs, firecrackerMAC/TapName/VM, parseFirecrackerType, load/saveFirecrackerMetadata, allocateFirecrackerIP, and the test helpers). - Files pkg/cloud/firecracker.go -> fc.go, firecracker_test.go -> fc_test.go. - README provider name + ONCTL_CLOUD updated. Deliberately KEPT (these name the Firecracker technology, not the provider): - the literal `firecracker` binary name (fc.binPath default), - the ~/.onctl/firecracker image/state directory paths (so existing image layouts keep working), - comments/strings describing the Firecracker API, VMM and microVMs, - the firecracker/firecracker-host-setup.sh template path in the README. go build / go vet / go test ./... all green; gofmt clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
Walkthrough for testing this branch on a GCP fc-host VM: building/copying the binary, running create/pause/resume/destroy against the new `fc` provider and flags, and confirming the old `firecracker` provider name is rejected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
Make --provider a globally usable short flag (-p) on the persistent root flag set. Since Cobra panics when a subcommand redefines a persistent shorthand, relocate the colliding short flags: - ssh --port: -p -> -P (matches scp/sftp -P convention) - create --ssh-port: -p -> -P - action --params: -p -> -j Update flag assertions in the affected tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EGdJJHgKUfLaNTJd5JbeXg
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
Adds
-pas a global short flag for--provider. Because--providerlives on the persistent (root) flag set, Cobra panics if any subcommand redefines the-pshorthand — so the three colliding short flags were relocated.Changes
--provider: now usable as-pgloballyssh --port:-p→-P(matchesscp/sftp -Pconvention)create --ssh-port:-p→-Paction --params:-p→-jssh_test.go,create_test.go,action_test.goTesting
go buildclean (no shorthand-redefinition panic)go test ./cmd/...passes--helpfor ssh/create/action/deploy resolves flags correctly🤖 Generated with Claude Code