Skip to content

Commit

Permalink
require non-empty group name for app-group commands
Browse files Browse the repository at this point in the history
  • Loading branch information
cppforlife committed Jan 3, 2020
1 parent 094402d commit 3e87dd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/kapp/cmd/appgroup/delete.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package appgroup

import (
"fmt"

"github.com/cppforlife/go-cli-ui/ui"
cmdapp "github.com/k14s/kapp/pkg/kapp/cmd/app"
cmdcore "github.com/k14s/kapp/pkg/kapp/cmd/core"
Expand Down Expand Up @@ -45,6 +47,10 @@ func NewDeleteCmd(o *DeleteOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Co
}

func (o *DeleteOptions) Run() error {
if len(o.AppGroupFlags.Name) == 0 {
return fmt.Errorf("Expected group name to be non-empty")
}

supportObjs, err := cmdapp.AppFactoryClients(o.depsFactory, o.AppGroupFlags.NamespaceFlags, cmdapp.ResourceTypesFlags{}, o.logger)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions pkg/kapp/cmd/appgroup/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func NewDeployCmd(o *DeployOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Co
}

func (o *DeployOptions) Run() error {
if len(o.AppGroupFlags.Name) == 0 {
return fmt.Errorf("Expected group name to be non-empty")
}

// TODO what if app is renamed? currently it
// will have conflicting resources with new-named app
updatedApps, err := o.appsToUpdate()
Expand Down

0 comments on commit 3e87dd9

Please sign in to comment.