Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/kubectl/pkg/util/templates"

"github.com/deckhouse/deckhouse-cli/internal/system/cmd/collect-debug-info/debugtar"
"github.com/deckhouse/deckhouse-cli/internal/system/cmd/collect-debug-info/virtualizationtar"
"github.com/deckhouse/deckhouse-cli/internal/utilk8s"
)

Expand Down Expand Up @@ -79,6 +80,8 @@ func NewCommand() *cobra.Command {
collectDebugInfoCmd.Flags().DurationVar(&commandTimeout, "command-timeout", 2*time.Minute, "Timeout for each individual debug command execution")
collectDebugInfoCmd.Flags().DurationVar(&requestInterval, "request-interval", 0, "Minimum interval between debug command executions to avoid overloading the cluster (e.g. 200ms, 500ms, 1s). Zero disables rate limiting (default 0s)")

collectDebugInfoCmd.AddCommand(virtualizationtar.NewCommand())

@ldmonster ldmonster Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First subcommand added, but Args is still nil — a typo silently runs the full archive

Affected lines: internal/system/cmd/collect-debug-info/collect-debug-info.go 56-77 (command literal with no Args:) + 83 (AddCommand)

collectDebugInfoCmd has a RunE and no Args:. Traced through cobra v1.10.2:

  1. Find -> innerfind descends to collect-debug-info; findNext("virtualisation") misses, so it returns this command with args ["virtualisation"].
  2. legacyArgs (args.go): if !cmd.HasSubCommands() { return nil } no longer short-circuits, but the unknown-command branch is guarded by !cmd.HasParent() — and this command has a parent (system) — so it returns nil. The "unknown command" error is root-only.
  3. ValidateArgs: if c.Args == nil { return ArbitraryArgs(...) } -> nil.
  4. RunE: func(cmd *cobra.Command, _ []string) discards the positional arg.

So d8 system collect-debug-info virtualisation > vm.tar.gz runs the full ~63-command cluster-wide collection into vm.tar.gz, exit 0, no "Did you mean" suggestion — after a long wait, and not the archive the user asked for.

Suggested change
collectDebugInfoCmd.AddCommand(virtualizationtar.NewCommand())
collectDebugInfoCmd.Args = cobra.NoArgs
collectDebugInfoCmd.AddCommand(virtualizationtar.NewCommand())

(Worth setting Args: cobra.NoArgs on the new virtualization command too.)


Comment thread
VaLosev marked this conversation as resolved.
return collectDebugInfoCmd
}

Expand Down
Loading
Loading