diff --git a/CHANGELOG.md b/CHANGELOG.md index fbacb797d5c..ba1164aa0c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ 1. [18888](https://github.com/influxdata/influxdb/pull/18888): Add event source to influx stack operations 1. [18910](https://github.com/influxdata/influxdb/pull/18910): Add uninstall functionality for stacks +1. [18912](https://github.com/influxdata/influxdb/pull/18912): Drop deprecated influx pkg command tree ### Bug Fixes diff --git a/cmd/influx/template.go b/cmd/influx/template.go index 7ff12e313c6..bb9f137a9e7 100644 --- a/cmd/influx/template.go +++ b/cmd/influx/template.go @@ -103,27 +103,8 @@ func newCmdPkgerBuilder(svcFn templateSVCsFn, f *globalFlags, opts genericCLIOpt } func (b *cmdTemplateBuilder) cmdApply() *cobra.Command { - cmd := b.cmdTemplateApply() - - deprecatedCmds := []*cobra.Command{ - b.cmdExport(), - b.cmdTemplateSummary(), - b.cmdStackDeprecated(), - b.cmdTemplateValidate(), - } - for i := range deprecatedCmds { - deprecatedCmds[i].Hidden = true - } - - cmd.AddCommand(deprecatedCmds...) - - return cmd -} - -func (b *cmdTemplateBuilder) cmdTemplateApply() *cobra.Command { cmd := b.newCmd("apply", b.applyRunEFn) enforceFlagValidation(cmd) - cmd.Aliases = []string{"pkg"} cmd.Short = "Apply a template to manage resources" cmd.Long = ` The apply command applies InfluxDB template(s). Use the command to create new @@ -572,19 +553,6 @@ func (b *cmdTemplateBuilder) exportStackRunEFn(cmd *cobra.Command, args []string } func (b *cmdTemplateBuilder) cmdTemplate() *cobra.Command { - cmd := b.newTemplateCmd("template") - cmd.Short = "Summarize the provided template" - cmd.AddCommand(b.cmdTemplateValidate()) - return cmd -} - -func (b *cmdTemplateBuilder) cmdTemplateSummary() *cobra.Command { - cmd := b.newTemplateCmd("summary") - cmd.Short = "Summarize the provided template" - return cmd -} - -func (b *cmdTemplateBuilder) newTemplateCmd(usage string) *cobra.Command { runE := func(cmd *cobra.Command, args []string) error { template, _, err := b.readTemplate() if err != nil { @@ -594,11 +562,13 @@ func (b *cmdTemplateBuilder) newTemplateCmd(usage string) *cobra.Command { return b.printTemplateSummary(0, template.Summary()) } - cmd := b.genericCLIOpts.newCmd(usage, runE, false) + cmd := b.genericCLIOpts.newCmd("template", runE, false) b.registerTemplateFileFlags(cmd) b.registerTemplatePrintOpts(cmd) + cmd.Short = "Summarize the provided template" + cmd.AddCommand(b.cmdTemplateValidate()) return cmd } @@ -620,7 +590,13 @@ func (b *cmdTemplateBuilder) cmdTemplateValidate() *cobra.Command { } func (b *cmdTemplateBuilder) cmdStacks() *cobra.Command { - cmd := b.newCmdStackList("stacks") + cmd := b.newCmd("stacks [flags]", b.stackListRunEFn) + cmd.Flags().StringArrayVar(&b.stackIDs, "stack-id", nil, "Stack ID to filter by") + cmd.Flags().StringArrayVar(&b.names, "stack-name", nil, "Stack name to filter by") + registerPrintOptions(cmd, &b.hideHeaders, &b.json) + + b.org.register(cmd, false) + cmd.Short = "List stack(s) and associated templates. Subcommands manage stacks." cmd.Long = ` List stack(s) and associated templates. Subcommands manage stacks. @@ -654,18 +630,6 @@ func (b *cmdTemplateBuilder) cmdStacks() *cobra.Command { return cmd } -// TODO(jsteenb2): nuke the deprecated command here after OSS beta13 release. -func (b *cmdTemplateBuilder) cmdStackDeprecated() *cobra.Command { - cmd := b.genericCLIOpts.newCmd("stack", nil, false) - cmd.Short = "Stack management commands" - cmd.AddCommand( - b.cmdStackInit(), - b.cmdStackList(), - b.cmdStackRemove(), - ) - return cmd -} - func (b *cmdTemplateBuilder) cmdStackInit() *cobra.Command { cmd := b.newCmd("init", b.stackInitRunEFn) cmd.Short = "Initialize a stack" @@ -724,25 +688,6 @@ func (b *cmdTemplateBuilder) stackInitRunEFn(cmd *cobra.Command, args []string) return b.writeStack(stack) } -func (b *cmdTemplateBuilder) cmdStackList() *cobra.Command { - cmd := b.newCmdStackList("list") - cmd.Short = "List stack(s) and associated resources" - cmd.Aliases = []string{"ls"} - return cmd -} - -func (b *cmdTemplateBuilder) newCmdStackList(cmdName string) *cobra.Command { - usage := fmt.Sprintf("%s [flags]", cmdName) - cmd := b.newCmd(usage, b.stackListRunEFn) - cmd.Flags().StringArrayVar(&b.stackIDs, "stack-id", nil, "Stack ID to filter by") - cmd.Flags().StringArrayVar(&b.names, "stack-name", nil, "Stack name to filter by") - registerPrintOptions(cmd, &b.hideHeaders, &b.json) - - b.org.register(cmd, false) - - return cmd -} - func (b *cmdTemplateBuilder) stackListRunEFn(cmd *cobra.Command, args []string) error { templateSVC, orgSVC, err := b.svcFn() if err != nil {