Skip to content

Commit

Permalink
chore(pkger): drop deprecated influx pkg command tree
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteenb2 committed Jul 10, 2020
1 parent 944b097 commit d1022f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 46 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 4 additions & 46 deletions cmd/influx/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
type templateSVCsFn func() (pkger.SVC, influxdb.OrganizationService, error)

func cmdApply(f *globalFlags, opts genericCLIOpts) *cobra.Command {
return newCmdPkgerBuilder(newPkgerSVC, f, opts).cmdApply()
return newCmdPkgerBuilder(newPkgerSVC, f, opts).cmdTemplateApply()
}

func cmdExport(f *globalFlags, opts genericCLIOpts) *cobra.Command {
Expand Down Expand Up @@ -102,28 +102,9 @@ 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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down Expand Up @@ -654,18 +624,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"
Expand Down

0 comments on commit d1022f1

Please sign in to comment.